Socket
Socket
Sign inDemoInstall

node-ipc

Package Overview
Dependencies
Maintainers
1
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-ipc - npm Package Compare versions

Comparing version 0.9.13 to 0.9.14

29

lib/client.js

@@ -11,3 +11,4 @@ var net = require('net'),

emit : emit,
log : log
log : log,
retryCount:0
}

@@ -37,9 +38,2 @@ new pubsub(client);

if(client.socket){
if(client.socket.destroyed){
client.log('Requested to connect or reconnect to a destroyed socket. Not attempting because socket distroyed'.notice);
return;
}
}
client.log('requested connection to '.debug, client.id.variable, client.path.variable);

@@ -88,2 +82,13 @@ if(!this.path){

client.log('connection closed'.notice ,client.id.variable , client.path.variable);
if(client.config.stopRetrying || client.config.stopRetrying===0){
if(client.retryCount++>client.config.stopRetrying){
client.log(client.config.id.variable,'exceeded connection rety amount of'.warn,client.config.stopRetrying);
client.socket.destroy();
return;
}
}
client.isRetrying=true;
setTimeout(

@@ -93,3 +98,11 @@ (

return function(){
client.isRetrying=false;
client.connect();
setTimeout(
function(){
if(!client.isRetrying)
client.retryCount=0;
},
100
)
}

@@ -96,0 +109,0 @@ }

@@ -29,3 +29,4 @@ var os = require('os'),

maxConnections : 100,
retry : 500
retry : 500,
stopRetrying : false,
}

@@ -32,0 +33,0 @@

{
"name": "node-ipc",
"version": "0.9.13",
"version": "0.9.14",
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.",

@@ -5,0 +5,0 @@ "main": "node-ipc.js",

@@ -34,2 +34,35 @@ #node-ipc

``ipc.config``
Set these variables in the ``ipc.config`` scope to overwrite or set default values.
{
appspace : 'app.',
socketRoot : '/tmp/',
id : os.hostname(),
networkHost : 'localhost',
networkPort : 8000,
encoding : 'utf8',
silent : false,
maxConnections : 100,
retry : 500,
stopRetrying : false
}
| variable | documentation |
|----------|---------------|
| appspace | used for Unix Socket (Unix Domain Socket) namespacing. If not set specifically, the Unix Domain Socket will combine the socketRoot, appspace, and id to form the Unix Socket Path for creation or binding. This is available incase you have many apps running on your system, you may have several sockets with the same id, but if you change the appspace, you will still have app specic unique sockets.|
| socketRoot| the directory in which to create or bind to a Unix Socket |
| id | the id of this socket or service |
| networkHost| the local or remote host on which TCP, TLS or UDP Sockets should connect |
| networkPort| the default port on which TCP, TLS, or UDP sockets should connect |
| encoding | the default encoding for data sent on sockets |
| 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. |
| stopRetrying| Defaults to false mwaning clients will continue to retryt to connect to servers indefinately at the retry interval. If set to any number the client will stop retrying when that number is exceeded after each disconnect. If set to 0, the client will ***NOT*** try to reconnect. |
----
#### IPC Methods

@@ -163,2 +196,17 @@ These methods are available in the IPC Scope.

----
##### disconnect
``ipc.disconnect(id)``
Used to disconnect a client from a Unix, TCP or TLS socket. The socket and its refrence will be removed from memory and the ``ipc.of`` scope. This can be local or remote. UDP clients do not maintain connections and so there are no Clients and this method has no value to them.
| variable | required | definition |
|----------|----------|------------|
| id | required | is the string id of the socket from which to disconnect. |
**examples**
ipc.disconnect('world');
----
##### serve

@@ -280,32 +328,2 @@ ``ipc.serve(path,callback);``

----
``ipc.config``
Set these variables in the ``ipc.config`` scope to overwrite or set default values.
{
appspace : 'app.',
socketRoot : '/tmp/',
id : os.hostname(),
networkHost : 'localhost',
networkPort : 8000,
encoding : 'utf8',
silent : false,
maxConnections : 100,
retry : 500
}
| variable | documentation |
|----------|---------------|
| appspace | used for Unix Socket (Unix Domain Socket) namespacing. If not set specifically, the Unix Domain Socket will combine the socketRoot, appspace, and id to form the Unix Socket Path for creation or binding. This is available incase you have many apps running on your system, you may have several sockets with the same id, but if you change the appspace, you will still have app specic unique sockets.|
| socketRoot| the directory in which to create or bind to a Unix Socket |
| id | the id of this socket or service |
| networkHost| the local or remote host on which TCP, TLS or UDP Sockets should connect |
| networkPort| the default port on which TCP, TLS, or UDP sockets should connect |
| encoding | the default encoding for data sent on sockets |
| 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. |
----
### Basic Examples

@@ -312,0 +330,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc