var WebSocketServer = require('ws').Server
wss = new WebSocketServer({ port: 8080, path:'/abcd' });
wss.on('connection', function connection(ws) {
ws.on('message', function incoming(message) {
console.log('received: %s', message);
ws.send('I received' + message + 'is that you sended?')
ws.send('connection will close in 8s');
setTimeout(function(){ws.close()},8000)
});
ws.send('connection works fine');
});