 <p>Something along the lines of this, however you will have to do more checks to see if the socket is still alive or not, etc.</p> <pre><code>var net = require('net'); var sockets = {}; var server = net.createServer(function(c) { //'connection' listener var name = generate_name_from_con(c); console.log('server connected'); sockets[name] = c; c.on('end', function() { delete sockets[n]; console.log('server disconnected'); }); c.write('hello\r\n'); c.pipe(c); }); server.listen(8124, function() { //'listening' listener console.log('server bound'); }); app.get('/msg/:theMsg', function (req, res) { res.setHeader('Content-Type', 'application/json'); if(socketName in sockets) sockets[socketName].write(req.params.theMsg); }); </code></pre>