You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
328 B
16 lines
328 B
const WebSocket = require('ws');
|
|
|
|
const wss = new WebSocket.Server({port: 7777});
|
|
|
|
wss.on('connection', ws => {
|
|
console.log(`conn ${ws}`);
|
|
ws.on('message', message => {
|
|
console.log(`got ${message}`);
|
|
ws.send(`Hello ${message}`);
|
|
});
|
|
ws.send("Start");
|
|
ws.on('close', () => {
|
|
console.log("closed");
|
|
});
|
|
});
|