Open a tcp socket and continuously read the stream in a non-working way. Items in the stream are seperated by a cartridge return. Use regex to remove the non numeric characters but allowing the decimal point from the item and add each cleaned item to a public queue named rawData.
function parseData(data) { // regex /[^\d.-]/g data = data.replace(/[^\d.-]/g, ''); rawData.push(data); } var net = require('net'); var client = new net.Socket(); client.connect(3000, '127.0.0.1', function() { console.log('Connected'); client.write('Hello, server! Love, Client.'); }); client.on('data', function(data) { console.log('Received: ' + data); parseData(data); client.destroy(); // kill client after server's response }); client.on('close', function() { console.log('Connection closed'); });