Skip to content

Instantly share code, notes, and snippets.

@scottgwald
Last active August 29, 2015 13:57
Show Gist options
  • Save scottgwald/9658318 to your computer and use it in GitHub Desktop.
Save scottgwald/9658318 to your computer and use it in GitHub Desktop.
[wearscript] GlassProv2
<html>
<body>
<script>
var me;
function main() {
WS.serverConnect('{{WSUrl}}', function () {
// WS.say("Server connected yeah.");
console.log(WSRAW.getGlassID());
me = WSRAW.getGlassID();
console.log(me);
// setTimeout(function () {
if (me == "f8:8f:ca:25:06:bf") {
WS.say("It's me");
} else {
WS.say("It's not me!");
}
// }, 2000);
WS.subscribe('lines:' + me, function(chan, data) {
console.log("Got a lines object!");
console.log(JSON.stringify(data));
if (data.glassID == me) {
console.log("It's me! And the text is: " + data.text);
WS.say(data.text);
} else {
console.log("It's not me. But the text is: " + data.text);
}
});
});
}
window.onload = main;
</script>
</body>
</html>
{
"name": "GlassProv2"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment