what happens is that I am communicating with node python, and the only way he is passing a string achievement by socket, but I can not transform it into an object already in javascript
python
from socket import *
if __name__ == "__main__":
client = socket(AF_INET,SOCK_STREAM)
client.connect(('127.0.0.1', 7000))
C = "{id:110041134,date:2013-03-11 19:42:43.570313}"
client.sendall(C)
client.close()
print 'Received', repr(data)
node
var HOST = '127.0.0.1';
var PORT = 7000;
net.createServer(function(python){
console.log('Python: ' + python.remoteAddress +':'+ python.remotePort);
// Add a 'data' event handler to this instance of python
python.on('data', function(data) {
console.log('' + data);
});
python.on('close', function(data) {
});
}).listen(PORT, HOST);
As a result I get:
console.log(data):
<Buffer 7b 69 64 75 6e 69 64 61 64 3a 31 31 37 32 32 30 30 30 34 31 31 35 33 34 2c 6c 61 74 69 74 75 64 3a 34 2e 37 35 31 39 37 35 34 33 33 33 33 2c 6c 6f 6e 67 ...>
console.log('' + data)
{id:110041134,date:2013-03-11 19:42:43.570313}
I think this is a great way to communicate information to the node to work.
but as passed the information to a readable format in javascript?
if this is not the best way of communicating processes could I say better?
Thank you.