2016-03-23 18:07:37 +11:00
|
|
|
const ipc=require('../../../node-ipc');
|
2014-02-22 20:13:31 +11:00
|
|
|
|
|
|
|
/***************************************\
|
2016-03-23 18:07:37 +11:00
|
|
|
*
|
2014-02-22 20:13:31 +11:00
|
|
|
* You should start both hello and world
|
|
|
|
* then you will see them communicating.
|
2016-03-23 18:07:37 +11:00
|
|
|
*
|
2014-02-22 20:13:31 +11:00
|
|
|
* *************************************/
|
|
|
|
|
2016-01-10 23:18:14 +11:00
|
|
|
ipc.config.id = 'world';
|
2014-02-22 20:13:31 +11:00
|
|
|
ipc.config.retry= 1500;
|
|
|
|
|
|
|
|
ipc.serve(
|
|
|
|
function(){
|
2017-02-15 00:23:49 +11:00
|
|
|
ipc.server.on(
|
|
|
|
'message',
|
|
|
|
function(data,socket){
|
|
|
|
ipc.log('got a message from ', socket.id, data);
|
|
|
|
ipc.server.emit(
|
|
|
|
socket,
|
|
|
|
'message',
|
|
|
|
data+' world!'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
ipc.server.on(
|
|
|
|
'socket.disconnected',
|
|
|
|
function(socket,id){
|
|
|
|
ipc.log('DISCONNECTED from ',id,'\n\n');
|
|
|
|
}
|
|
|
|
);
|
2014-02-22 20:13:31 +11:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
2015-12-10 21:29:15 +11:00
|
|
|
|
2014-02-22 20:13:31 +11:00
|
|
|
|
2014-02-28 07:23:53 +11:00
|
|
|
ipc.server.start();
|