新网创想网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
npm install ws
var WebSocketServer = require('ws').Server,
wss = new WebSocketServer({ port: 8080 });
wss.on('connection', function (ws) {
console.log('client connected');
ws.on('message', function (message) {
console.log(message);
});
});