-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhello-client.js
46 lines (42 loc) · 1.16 KB
/
hello-client.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
const ipc=require('node-ipc');
/***************************************\
*
* You should start both hello and world
* then you will see them communicating.
*
* *************************************/
ipc.config.id = 'hello';
ipc.config.retry = 1000;
//ipc.config.silent=true;
ipc.connectTo(
'worldtest',
function(){
var msg={testme: "Howdy", val:42};
ipc.of.worldtest.emit('app.message',{id: ipc.config.id, message: JSON.stringify(msg)});
//process.exit();
ipc.of.worldtest.on(
'connect',
function(){
ipc.log('## connected to world ##', ipc.config.delay);
//ipc.of.worldtest.emit('app.message',{id: ipc.config.id, message: 'howdy'});
//process.exit();
}
);
ipc.of.worldtest.on(
'disconnect',
function(){
ipc.log('disconnected from world');
process.exit();
}
);
ipc.of.worldtest.on(
'app.message',
function(data){
ipc.log('got a message from world : ', data);
process.exit();
}
);
//
// console.log(ipc.of.world.destroy);
}
);