Am sending information from python to node, this information comes through the python function and the data is received in python_pipe, what I want is to make a io.sockets.emit
in connection when I get the data from python.
// socket.io
var connection = function(socket){
socket.on('infouser', function(user){
users[user.id] = user;
});
socket.on('disconnect', function(){
console.log(users[socket.store.id]);
delete users[socket.store.id];
});
}
// python
var python_pipe = function(python){
console.log('Python: ' + python.remoteAddress +':'+ python.remotePort);
python.on('data', function(data) {
var event_python = JSON.parse(data);
events[event_python.id] = event_python;
//python.write('Retorno de consulta: "' + data + '"');
});
python.on('close', function(data) {
});
}
io.sockets.on('connection', connection);
net.createServer(python_pipe).listen(PYPORT, PYHOST);
console.log('Escuchando Python en ' + PYHOST +':'+ PYPORT);
server.listen(3030,127.0.0.1);
How would you do it?