Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wss.on('connection', function(ws)
- {
- wssClients.push(ws);
- wssClientCount++;
- ws.send("Connected");
- console.log("Websocket Connected");
- ws.on('message', function(message)
- {
- if (message == "status")
- {
- messageToSend = '{"action": "subscribe"}';
- wsClient.getClient().send(messageToSend)
- console.log("Status sent");
- }
- else
- {
- sendAll("system", message);
- }
- });
- ws.on('close', function(ws)
- {
- wssClients.splice(ws, 1);
- wssClientCount--;
- console.log("Websocket Closed");
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement