title: Node net.Socket emit data to all connected clients
body: <p>guys, I'm trying to make simple TCP server with net.Socket package I'm using the express framework.
  The behaviour that Im trying to achieve is when user enters specific route to emmit data to all connected clients, doesn anyone now how could I achieve this ??</p>
  
  <p>Here is my sample code:</p>
  
  <pre><code>const express = require('express');
  const app = express();
  const cors = require('cors');
  const bodyParser = require('body-parser');
  const net = require('net');
  
  const PORT = 5000;
  let connection;
  
  
  const server = net.createServer((socket) =&gt; {
      console.log('CONNECTED: ' + socket.remoteAddress +':'+ socket.remotePort);
      connection = socket;
  });
  
  
  app.use(cors());
  app.use(bodyParser.json());
  
  app.get('/', (request, response) =&gt; {
      response.send('VMS server');
  });
  
  
  app.post('/contact', (req, res) =&gt; {
  const data = { hello: 'hello' }
  connection.write(data);
  res.send({ data: 'data emmited' })
  });
  
  app.listen(PORT, () =&gt; {
      console.log(`Server running at: http://localhost:${PORT}/`);
  });
  
  server.listen(1337, function() {
      console.log("Listening on 1337");
  });
  </code></pre>
  
  <p>The problem m having here is that data is gettings emitted multiple times, because Im assigning current socket to connection variable.</p>
  
  <p>Is there any other way how I can do this, could I use server variable to emit to all connected clients somehow ?</p>