Created
February 27, 2019 05:12
-
-
Save devarajchidambaram/89ccd0204561dc650ec510d273173153 to your computer and use it in GitHub Desktop.
web socket server
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
const WebSocket = require('ws'); | |
const wss = new WebSocket.Server({ port: 8080 }); | |
wss.on('connection', function connection(ws) { | |
ws.on('message', function incoming(message) { | |
console.log('messsage received: %s', message); | |
}); | |
setInterval(function(){ | |
ws.send('send notifications 5 secs once'); | |
}, 5000) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment