For server implementation you can use for example the ws module for node.js.
Below is sample server side code:
var WebSocketServer = require('ws').Server , wss = new WebSocketServer({port: 8080}); console.log('Starting server'); wss.on('connection', function(ws) { console.log('user is connected'); ws.send('user connected. Welcome.'); ws.on('message', function(message) { console.log('received: %s', message); ws.send('Response to ' + message); }); ws.on('disconnect', function() { console.log('user disconnected'); }); });
Happy codding!