Created
August 16, 2016 08:34
-
-
Save compilerexe/aed623d74a4e803d2d34beb6a351fc59 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| <script src="../microgear.js"></script> | |
| <script> | |
| const APPID = "HomeModel"; | |
| const KEY = "D4jjs3sj7iktGgP"; | |
| const SECRET = "h1F2WCI6t45pXQOj64lNMTGzw"; | |
| const ALIAS = "htmlgear"; | |
| var microgear = Microgear.create({ | |
| key: KEY, | |
| secret: SECRET, | |
| alias : ALIAS | |
| }); | |
| microgear.on('message',function(topic,msg) { | |
| document.getElementById("data").innerHTML = msg; | |
| }); | |
| microgear.on('connected', function() { | |
| microgear.setAlias(ALIAS); | |
| document.getElementById("data").innerHTML = "Now I am connected with netpie..."; | |
| microgear.chat("NodeMCU","R40"); | |
| }); | |
| microgear.on('present', function(event) { | |
| console.log(event); | |
| }); | |
| microgear.on('absent', function(event) { | |
| console.log(event); | |
| }); | |
| microgear.resettoken(function(err) { | |
| microgear.connect(APPID); | |
| }); | |
| </script> | |
| <div id="data">_____</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment