removed support for define

This commit is contained in:
Brandon Nozaki Miller 2015-12-10 02:29:15 -08:00
parent e243ed9a29
commit e48fd1da8b
19 changed files with 34 additions and 39 deletions

View file

@ -450,8 +450,8 @@ or specifying everything UDP
|connect||triggered when socket connected| |connect||triggered when socket connected|
|disconnect||triggered when socket disconnected| |disconnect||triggered when socket disconnected|
|destroy||triggered when socket has been totally destroyed, no further auto retries will happen and all references are gone.| |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.log('got a message : '.debug, data);
ipc.server.emit( ipc.server.emit(
socket, socket,
'message', 'message', //this can be anything you want so long as
//your client knows.
data+' world!' data+' world!'
); );
} }
@ -506,7 +507,7 @@ The client connects to the servers socket for Inter Process Communication. The s
function(){ function(){
ipc.log('## connected to world ##'.rainbow, ipc.config.delay); ipc.log('## connected to world ##'.rainbow, ipc.config.delay);
ipc.of.world.emit( ipc.of.world.emit(
'message', 'message', //any event or message type your server listens for
'hello' 'hello'
) )
} }
@ -518,7 +519,7 @@ The client connects to the servers socket for Inter Process Communication. The s
} }
); );
ipc.of.world.on( ipc.of.world.on(
'message', 'message', //any event or message type your server listens for
function(data){ function(data){
ipc.log('got a message from world : '.debug, 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(); 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(); ipc.server.start();
``` ```

View file

@ -1,10 +1,10 @@
var ipc=require('../../../node-ipc'); var ipc=require('../../../node-ipc');
/***************************************\ /***************************************\
* *
* You should start both hello and world * You should start both hello and world
* then you will see them communicating. * then you will see them communicating.
* *
* *************************************/ * *************************************/
ipc.config.id = 'world'; ipc.config.id = 'world';
@ -30,7 +30,7 @@ ipc.serveNet(
message : data.message+' world!' message : data.message+' world!'
} }
); );
if(messages.hello && messages.goodbye){ if(messages.hello && messages.goodbye){
ipc.log('got all required events, telling clients to kill connection'.good); ipc.log('got all required events, telling clients to kill connection'.good);
ipc.server.broadcast( 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(); ipc.server.start();

View file

@ -1,10 +1,10 @@
var ipc=require('../../../node-ipc'); var ipc=require('../../../node-ipc');
/***************************************\ /***************************************\
* *
* You should start both hello and world * You should start both hello and world
* then you will see them communicating. * then you will see them communicating.
* *
* *************************************/ * *************************************/
ipc.config.id = 'world'; ipc.config.id = 'world';
@ -23,7 +23,7 @@ ipc.serveNet(
); );
} }
); );
ipc.server.on( ipc.server.on(
'socket.disconnected', 'socket.disconnected',
function(data,socket){ 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();

View file

@ -9,7 +9,7 @@ var ipc=require('../../../node-ipc');
ipc.config.id = 'world'; ipc.config.id = 'world';
ipc.config.retry= 1500; ipc.config.retry= 1500;
ipc.config.sync = true; //sync servers do not bradcast defined events ipc.config.sync = true;
ipc.serveNet( ipc.serveNet(
function(){ 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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -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(); ipc.server.start();

View file

@ -31,7 +31,7 @@ var defaults={
id : os.hostname(), id : os.hostname(),
encoding : 'utf8', encoding : 'utf8',
rawBuffer : false, rawBuffer : false,
sync : false, sync : false,
silent : false, silent : false,
maxConnections : 100, maxConnections : 100,
retry : 500, retry : 500,