Created
July 22, 2015 23:00
-
-
Save melvincarvalho/b788a8833783bf3b4a82 to your computer and use it in GitHub Desktop.
connect to websodket
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 WebSocket = require('ws'); | |
| process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; | |
| var ws = new WebSocket('wss://databox.me/'); | |
| ws.on('open', function open() { | |
| console.log('connected'); | |
| ws.send('ping'); | |
| }); | |
| ws.on('close', function close() { | |
| console.log('disconnected'); | |
| }); | |
| ws.on('message', function message(data, flags) { | |
| console.log(data); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment