mirror of
https://github.com/github/codeql.git
synced 2026-03-30 20:28:15 +02:00
17 lines
494 B
JavaScript
17 lines
494 B
JavaScript
const WebSocket = require('ws');
|
|
|
|
(function () {
|
|
const wss = new WebSocket.Server({ port: 8080 });
|
|
|
|
wss.on('connection', function connection(ws) { // $ serverSocket
|
|
ws.on('message', function incoming(message) { // $ remoteFlow
|
|
console.log('received: %s', message);
|
|
}); // $ serverReceive
|
|
|
|
ws.send('Hi from server!'); // $ serverSend
|
|
});
|
|
})();
|
|
|
|
module.exports.MyWebSocketServer = require('ws').Server;
|
|
module.exports.myWebSocketServerInstance = new WebSocket.Server({ port: 8080 });
|