forked from downwa/ar2dscript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhello2-client.js
More file actions
52 lines (45 loc) · 1.36 KB
/
Copy pathhello2-client.js
File metadata and controls
52 lines (45 loc) · 1.36 KB
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
47
48
49
50
51
52
const ipc=require('node-ipc');
/***************************************\
*
* You should start both goodbye and world
* then you will see them communicating.
*
* *************************************/
ipc.config.id = 'hello';
ipc.config.retry = 1000;
var appName='ar2dscript-_index';
var session='d207bd65cb9373ba18967055553d4692b0f512c69313fb252771ccec602592e1';
var appId=appName+'-'+session;
ipc.connectTo(
appId,
function(){
var msg={fn: "onClick", id:42};
ipc.of[appId].emit('app.message',{id: ipc.config.id, message: JSON.stringify(msg)});
// ipc.of.world.on(
// 'connect',
// function(){
// ipc.log('## connected to world ##', ipc.config.delay);
// ipc.of.world.emit(
// 'app.message',
// {
// id : ipc.config.id,
// message : 'goodbye'
// }
// );
// }
// );
// ipc.of.world.on(
// 'disconnect',
// function(){
// ipc.log('disconnected from world');
// }
// );
ipc.of[appId].on(
'app.message',
function(data){
ipc.log('got a message from server : ', data);
}
);
console.log(ipc.of[appId].destroy);
}
);