title: Node Websockets Broadcast not working
body: <p>Currently having an issue with "Broadcast" not seeming to function properly with a super simple websocket setup I started in Node. This is my first time working with websockets so I may be missing something pretty apparent, but after looking online for a while I wasn't able to find a resolution.</p>
  
  <p>Basically I am just trying to have the ability to push some json out to all currently connected Clients.</p>
  
  <p>I can confirm that that socket is working because I am able to see the static connection string on 'ws.send' in the 'connection' block when I connect at ws://localhost:3000, as well as seeing mulitple clients logged out from the broadcast method if I connect with multiple clients. </p>
  
  <p>Any help as to what I may be missing would be greatly appreciated,</p>
  
  <pre><code>var WebSocketServer = require('uws').Server;
  var wss = new WebSocketServer({ port: 3000 }); // ws://localhost:3000
  
  // Static test var
  var test_message = {
      'test': 'Response',
      'test2': 'Response2'
  };
  
  // Broadcast to all.
  wss.broadcast = function broadcast(data) {
    wss.clients.forEach(function each(client) {
      console.log('IT IS GETTING INSIDE CLIENTS');
      console.log(client);
  
      // The data is coming in correctly
      console.log(data);
      client.send(data);
    });
  };
  
  wss.on('connection', function(ws) {
     ws.on('message', function(message) {
       wss.broadcast(test_message);
       console.log('Received: ' + message);
     });
  
     // TODO This is static just to check that the connection is properly working
     ws.send('You successfully connected to the websocket.');
  });
  </code></pre>