Guest User

Untitled

a guest
Mar 18th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. const WebSocketServer = require('ws').Server;
  2. const WSS = new WebSocketServer({port: 3333});
  3.  
  4. WSS.on('connection', (ws)=>{
  5.  
  6. console.log('We are connected');
  7.  
  8. ws.on("message", (message) => {
  9.  
  10. WSS.clients.forEach((client)=>{
  11. client.send(message);
  12. });
  13.  
  14. console.log(message);
  15.  
  16. });
  17.  
  18. });
Add Comment
Please, Sign In to add comment