I have an electron app where different clients communicate with a server over a Network using node-ipc
.
As long as the client connects to the server first it is no problem to answer that specific client. According to the docs I have on the Server:
NodeIpc.serveNet(
function () {
NodeIpc.server.on(
'Client.message',
function (data, socket) {
NodeIpc.log('got a message from', (data.id), (data.message));
NodeIpc.server.emit(
socket,
'ServerData',
{
message: 'have some initial cofiguration data'
}
);
);
NodeIpc.server.start();
}
and on my Client:
NodeIPC.connectToNet(
'world',
function(){
NodeIPC.of.world.on(
'connect',
function(){
NodeIPC.log('## connected to world ##', NodeIPC.config.delay);
NodeIPC.of.world.emit(
'Client.message',
{
id : UniqueClientID,
message : 'Some information about myself'
}
);
});
});
That works great, but I cannot figure out how to push some additional information to a specific client some time Later. Trying
NodeIpc.server.of['UniqueClientID'].emit(
'additional Data',
{
message: 'some more configuration'
}
)
});
and
NodeIpc.server.emit(
UniqueClientID,
'additional Data',
{
message: 'some more configuration'
});
do not work. Does anyone know how to send a message to a given client? (of course there is always the possibility to broadcast that message and let the client decide if it's for him, but I would prefer to talk to the directly)