Created
October 14, 2018 03:08
-
-
Save MacTanomsup/0c55650cfc7425d0d725bd1b169ee52a 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
| var MicroGear = require('microgear'); | |
| const APPID = <APPID>; | |
| const KEY = <APPKEY>; | |
| const SECRET = <APPSECRET>; | |
| var microgear = MicroGear.create({ | |
| key : KEY, | |
| secret : SECRET | |
| }); | |
| microgear.on('connected', function() { | |
| console.log('Connected...'); | |
| microgear.setAlias("mygear"); | |
| setInterval(function() { | |
| microgear.chat('mygear', 'Hello world.'); | |
| },1000); | |
| }); | |
| microgear.on('message', function(topic,body) { | |
| console.log('incoming : '+topic+' : '+body); | |
| }); | |
| microgear.on('closed', function() { | |
| console.log('Closed...'); | |
| }); | |
| microgear.connect(APPID); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment