removed support for define
This commit is contained in:
parent
e243ed9a29
commit
e48fd1da8b
19 changed files with 34 additions and 39 deletions
15
README.md
15
README.md
|
@ -450,8 +450,8 @@ or specifying everything UDP
|
|||
|connect||triggered when socket connected|
|
||||
|disconnect||triggered when socket disconnected|
|
||||
|destroy||triggered when socket has been totally destroyed, no further auto retries will happen and all references are gone.|
|
||||
||||
|
||||
||||
|
||||
|data|buffer|triggered when ipc.config.rawBuffer is true and a message is received.|
|
||||
|***your event type***|***your event data***|triggered when a JSON message is received. The event name will be the type string from your message and the param will be the data object from your message eg : ` { type:'myEvent',data:{a:1}} ` |
|
||||
||||
|
||||
|
||||
----
|
||||
|
@ -476,7 +476,8 @@ The server is the process keeping a socket for IPC open. Multiple sockets can co
|
|||
ipc.log('got a message : '.debug, data);
|
||||
ipc.server.emit(
|
||||
socket,
|
||||
'message',
|
||||
'message', //this can be anything you want so long as
|
||||
//your client knows.
|
||||
data+' world!'
|
||||
);
|
||||
}
|
||||
|
@ -506,7 +507,7 @@ The client connects to the servers socket for Inter Process Communication. The s
|
|||
function(){
|
||||
ipc.log('## connected to world ##'.rainbow, ipc.config.delay);
|
||||
ipc.of.world.emit(
|
||||
'message',
|
||||
'message', //any event or message type your server listens for
|
||||
'hello'
|
||||
)
|
||||
}
|
||||
|
@ -518,7 +519,7 @@ The client connects to the servers socket for Inter Process Communication. The s
|
|||
}
|
||||
);
|
||||
ipc.of.world.on(
|
||||
'message',
|
||||
'message', //any event or message type your server listens for
|
||||
function(data){
|
||||
ipc.log('got a message from world : '.debug, data);
|
||||
}
|
||||
|
@ -567,8 +568,6 @@ This is the most basic example which will work for both local and remote UDP Soc
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
ipc.server.start();
|
||||
|
||||
```
|
||||
|
@ -606,8 +605,6 @@ This is the most basic example which will work for both local and remote UDP Soc
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
ipc.server.start();
|
||||
|
||||
```
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
var ipc=require('../../../node-ipc');
|
||||
|
||||
/***************************************\
|
||||
*
|
||||
*
|
||||
* You should start both hello and world
|
||||
* then you will see them communicating.
|
||||
*
|
||||
*
|
||||
* *************************************/
|
||||
|
||||
ipc.config.id = 'world';
|
||||
|
@ -30,7 +30,7 @@ ipc.serveNet(
|
|||
message : data.message+' world!'
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
if(messages.hello && messages.goodbye){
|
||||
ipc.log('got all required events, telling clients to kill connection'.good);
|
||||
ipc.server.broadcast(
|
||||
|
@ -45,7 +45,7 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen['app.message']='This event type listens for message strings as value of data key.';
|
||||
ipc.server.define.broadcast['kill.connection']='This event is a command to kill connection to this server, the data object will contain the id of this server incase the client needs it';
|
||||
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
var ipc=require('../../../node-ipc');
|
||||
|
||||
/***************************************\
|
||||
*
|
||||
*
|
||||
* You should start both hello and world
|
||||
* then you will see them communicating.
|
||||
*
|
||||
*
|
||||
* *************************************/
|
||||
|
||||
ipc.config.id = 'world';
|
||||
|
@ -23,7 +23,7 @@ ipc.serveNet(
|
|||
);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
ipc.server.on(
|
||||
'socket.disconnected',
|
||||
function(data,socket){
|
||||
|
@ -33,6 +33,4 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
ipc.server.start();
|
||||
ipc.server.start();
|
||||
|
|
|
@ -9,7 +9,7 @@ var ipc=require('../../../node-ipc');
|
|||
|
||||
ipc.config.id = 'world';
|
||||
ipc.config.retry= 1500;
|
||||
ipc.config.sync = true; //sync servers do not bradcast defined events
|
||||
ipc.config.sync = true;
|
||||
|
||||
ipc.serveNet(
|
||||
function(){
|
||||
|
@ -40,6 +40,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -49,7 +49,7 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen['app.message']='This event type listens for message strings as value of data key.';
|
||||
ipc.server.define.broadcast['kill.connection']='This event is a command to kill connection to this server, the data object will contain the id of this server incase the client needs it';
|
||||
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -37,6 +37,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -43,6 +43,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -44,6 +44,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -37,6 +37,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -43,6 +43,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -43,6 +43,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
|
@ -43,6 +43,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
|
@ -58,6 +58,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
|
@ -47,6 +47,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
|
@ -43,6 +43,6 @@ ipc.serveNet(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
|
@ -45,7 +45,7 @@ ipc.serve(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen['app.message']='This event type listens for message strings as value of data key.';
|
||||
ipc.server.define.broadcast['kill.connection']='This event is a command to kill connection to this server, the data object will contain the id of this server incase the client needs it';
|
||||
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -29,6 +29,6 @@ ipc.serve(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen['app.message']='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -36,6 +36,6 @@ ipc.serve(
|
|||
}
|
||||
);
|
||||
|
||||
ipc.server.define.listen['app.message']='This event type listens for message strings as value of data key.';
|
||||
|
||||
|
||||
ipc.server.start();
|
||||
|
|
|
@ -31,7 +31,7 @@ var defaults={
|
|||
id : os.hostname(),
|
||||
encoding : 'utf8',
|
||||
rawBuffer : false,
|
||||
sync : false,
|
||||
sync : false,
|
||||
silent : false,
|
||||
maxConnections : 100,
|
||||
retry : 500,
|
||||
|
|
Loading…
Reference in a new issue