I am running a node-ipc server with the following code. I created a socket to which external programs (python in my case) should connect.
var ipc = require('node-ipc').default;
ipc.config.id = 'world';
ipc.config.retry= 1500;
ipc.serve(
function(){
ipc.server.on(
'message',
function(data,socket){
ipc.log('got a message : '.debug, data);
ipc.server.emit(
socket,
'message',
data+' world!'
);
}
);
}
);
ipc.server.start();
Now what I am trying to achieve is to execute a python script that can connect to the socket, I have created, and send a message.
The Problem is that I do not know what kind of library is the best to use on python side to send a message to my Node.Js application. I have tried with multiprocessing but I do not know how to set up the client correctly to correspond to node-ipc.
from multiprocessing.connection import Client
import time
conn = Client(('localhost', 6000), authkey=b'secret password') #no sure what to set up
conn.send('message')
conn.close()
Is there a change necessary on my python code or node code? What else could I try?