Last active
August 29, 2015 14:11
-
-
Save minakhan01/97212819eb1cf58ae120 to your computer and use it in GitHub Desktop.
[wearscript] pub_subs.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- WearScript on Glass/Android --> | |
<html style="width:100%; height:100%; overflow:hidden"> | |
<body style="width:100%; height:100%; overflow:hidden; margin:0"> | |
<script> | |
function main() { | |
if (WS.scriptVersion(1)) return; | |
WS.say('Welcome to WearScript'); | |
WS.serverConnect('{{WSUrl}}', function () { | |
WS.subscribe('pong', function (chan, timestamp0, timestamp1, groupDevice) { | |
WS.log('Pong: ' + groupDevice + ': Remote - Glass0: ' + (timestamp1 - timestamp0) + ' Glass1 - Glass0: ' + (((new Date).getTime() / 1000) - timestamp0)); | |
}); | |
setInterval(function () { | |
WS.publish('ping', 'pong', (new Date).getTime() / 1000); | |
WS.log('in ping publish: '+(new Date).getTime() / 1000); | |
}, 250); | |
}); | |
} | |
window.onload = main; | |
</script></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"name":"Example"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment