Forward data from UDP Socket to HTTP Server Node.js <p>I am looking to create a Web Service from data that is being retrieved via UDP connection and have decided to use Node.js and Socket.IO but, have come up short in that I think this combination does not give me the result I want. I was hoping someone could point me in the right direction. </p> <p>Right now, I have the following:</p> <pre><code>// require http, socket and socket.io var http = require('http'); var dgram = require('dgram'); var socketio = require('socket.io'); // setup HTTP server, Socket.IO and UDP Socket var server = http.createServer( handleRequest ), io = socketio.listen(server), socket = dgram.createSocket("udp4"); // Every time I receive a UDP Message socket.on("message", function(msg,rinfo) { // create a buffer we will store to var buffer = new Buffer(msg.length); // copy entire message into buffer msg.copy(buffer, 0, 0, msg.length); // if the message has length &gt; 3 if ( buffer.length &gt; 3 ) { .... take data off the socket .... // Create an XML document var xml = "&lt;?xml version=\"1.0\" encoding=\"UTF-8\" ?&gt;\n"; xml += ... ; xml += ... ; // emit a udp message event io.sockets.emit('udp message', xml); } }); function handleRequest(req, res) { res.writeHead(200, {'content-type': 'text/html'}); res.end("&lt;!doctype html&gt; \ &lt;html&gt;&lt;head&gt; \ &lt;script src='/socket.io/socket.io.js'&gt;&lt;/script&gt; \ &lt;script&gt; \ var socket = io.connect('localhost', {port: 8888}); \ socket.on('udp message', function(message) { res.end(message) }); \ &lt;/script&gt;&lt;/head&gt;&lt;/html&gt;"); } socket.bind(9876); server.listen(8888); </code></pre> <p>Everything works well recv'ing the UDP data stream, creating the XML documents and I can see the XML being sent to the WebSocket but, I cannot retrieve the XML. Basically, I want a to continuously stream the XML once a user connects to the Web Service</p> <p>Thoughts ? Dennis</p>