title: WS websocket send() as a function
body: <p>I'm having some issues with this. I'm connecting with socket.io (works) to another server, I want to send by WS to a client (processing). The main problem is that it just sends once, I want to send all the time that the socket.io gets an input.</p>
  
  <p>Actual code:</p>
  
  <pre><code>var io = require("socket.io-client");
  var socket = io.connect('http://socket.io.server:8000');
  var WebSocketServer = require('ws').Server
   , wss = new WebSocketServer({port: 8080});
  
  var temp = 0;
  
  socket.on('connect', function () {
      console.log("socket connected") ;
  });
  
  socket.on('udp message', function(msg) { 
      temp = msg/100;
      console.log(temp) ;
      wss.on('connection', function(ws) {
            ws.send(temp.toString());
      });
  });
  </code></pre>
  
  <p>What I Wanted:</p>
  
  <pre><code>socket.on('udp message', function(msg) { 
      temp = msg/100;
      console.log(temp) ;
      ws.send(temp.toString());
  
  });
  
  
   wss.on('connection', function(ws) {
      console.log("Connected to client")
  });
  </code></pre>
  
  <p>This way I could have a realtime data in my WS client.</p>