From e243ed9a29dc2bcf13f136cc2ba1a6e32f554c96 Mon Sep 17 00:00:00 2001 From: Brandon Nozaki Miller Date: Thu, 10 Dec 2015 02:20:44 -0800 Subject: [PATCH] removed support for unused define brodcasting and listening --- README.md | 23 +++++++++++++++++--- lib/socketServer.js | 52 --------------------------------------------- 2 files changed, 20 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index f37d56f..c9bd373 100644 --- a/README.md +++ b/README.md @@ -33,13 +33,14 @@ This work is licenced via the [DBAD Public Licence](http://www.dbad-license.org/ 5. [serve](#serve) 6. [serveNet](#servenet) 3. [IPC Stores and Default Variables](#ipc-stores-and-default-variables) -4. [Basic Examples](#basic-examples) +4. [IPC Events](#ipc-events) +5. [Basic Examples](#basic-examples) 1. [Server for Unix||Windows Sockets & TCP Sockets](#server-for-unix-sockets--tcp-sockets) 2. [Client for Unix||Windows Sockets & TCP Sockets](#client-for-unix-sockets--tcp-sockets) 4. [Server & Client for UDP Sockets](#server--client-for-udp-sockets) 5. [Raw Buffers or Binary Sockets](#raw-buffer-or-binary-sockets) -5. [Working with TLS/SSL Socket Servers & Clients](https://github.com/RIAEvangelist/node-ipc/tree/master/example/TLSSocket) -6. [Advanced Examples](https://github.com/RIAEvangelist/node-ipc/tree/master/example) +6. [Working with TLS/SSL Socket Servers & Clients](https://github.com/RIAEvangelist/node-ipc/tree/master/example/TLSSocket) +7. [Advanced Examples](https://github.com/RIAEvangelist/node-ipc/tree/master/example) ---- @@ -74,6 +75,7 @@ Set these variables in the `ipc.config` scope to overwrite or set default values networkPort : 8000, encoding : 'utf8', rawBuffer : false, + sync : false, silent : false, maxConnections : 100, retry : 500, @@ -92,6 +94,7 @@ Set these variables in the `ipc.config` scope to overwrite or set default values | networkPort| the default port on which TCP, TLS, or UDP sockets should connect | | encoding | the default encoding for data sent on sockets. Mostly used if rawBuffer is set to true. Valid values are : ` ascii` ` utf8 ` ` utf16le` ` ucs2` ` base64` ` hex ` . | rawBuffer| if true, data will be sent and received as a raw node ` Buffer ` __NOT__ an ` Object ` as JSON. This is great for Binary or hex IPC, and communicating with other processes in languages like C and C++ | +| sync | synchronous requests. Clients will not send new requests until the server answers. Servers will not broadcast initial events on connection | | silent | turn on/off logging default is false which means logging is on | | maxConnections| this is the max number of connections allowed to a socket. It is currently only being set on Unix Sockets. Other Socket types are using the system defaults. | | retry | this is the time in milliseconds a client will wait before trying to reconnect to a server if the connection is lost. This does not effect UDP sockets since they do not have a client server relationship like Unix Sockets and TCP Sockets. | @@ -437,6 +440,20 @@ or specifying everything UDP | ipc.of | This is where socket connection refrences will be stored when connecting to them as a client via the `ipc.connectTo` or `iupc.connectToNet`. They will be stored based on the ID used to create them, eg : ipc.of.mySocket| | ipc.server| This is a refrence to the server created by `ipc.serve` or `ipc.serveNet`| +---- + +### IPC Events + +|event name|params|definition| +|----------|------|----------| +|error|err obj|triggered when an error has occured| +|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.| +|||| +|||| +|||| + ---- ### Basic Examples You can find [Advanced Examples](https://github.com/RIAEvangelist/node-ipc/tree/master/example) in the examples folder. In the examples you will find more complex demos including multi client examples. diff --git a/lib/socketServer.js b/lib/socketServer.js index 973d38e..92a858b 100644 --- a/lib/socketServer.js +++ b/lib/socketServer.js @@ -72,16 +72,6 @@ function init(path,config,log,port){ sockets : [], emit : emit, broadcast : broadcast, - define : { - listen : { - 'get.events.broadcasting' : 'does not require any special paramaters', - 'get.events.listening' : 'does not require any special paramaters' - }, - broadcast : { - 'events.broadcasting' : 'data.events is a JSON object of event definitions by type '+config.id+' will broadcast on '+path, - 'events.listening' : 'data.events is a JSON object of event definitions by type '+config.id+' is listening for on '+path - } - }, onStart : function(socket){ this.trigger( 'start', @@ -266,20 +256,6 @@ function init(path,config,log,port){ if(server.config.rawBuffer){ return; } - - if(server.config.sync){ - return; - } - - server.trigger( - 'get.events.broadcasting', - socket - ); - - server.trigger( - 'get.events.listening', - socket - ); } function started(socket){ @@ -334,34 +310,6 @@ function init(path,config,log,port){ new pubsub(server); - server.on( - 'get.events.broadcasting', - function(socket){ - server.emit( - socket, - 'events.broadcasting', - { - id : server.config.id, - events : server.define.broadcast - } - ); - } - ); - - server.on( - 'get.events.listening', - function(socket){ - server.emit( - socket, - 'events.listening', - { - id : server.config.id, - events : server.define.listen, - } - ); - } - ) - server.on( 'close', function(){