Socket
Socket
Sign inDemoInstall

node-ipc

Package Overview
Dependencies
Maintainers
7
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 5.2.0 to 6.0.0

dao/client.js

6

example/TCPSocket/basic/hello-client.js

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -24,3 +24,3 @@

'hello'
)
);
}

@@ -43,2 +43,2 @@ );

console.log(ipc)
console.log(ipc);

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -32,3 +32,3 @@ ipc.config.maxConnections=1;

function(data,socket){
console.log(arguments)
console.log(arguments);
}

@@ -42,6 +42,6 @@ );

function(err){
ipc.log('Got an ERROR!'.warn,err)
ipc.log('Got an ERROR!'.warn,err);
}
)
);
ipc.server.start();

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -28,3 +28,3 @@ ipc.config.sync= true;

'hello'+i
)
);
}

@@ -48,2 +48,2 @@ }

console.log(ipc)
console.log(ipc);

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -38,3 +38,3 @@ ipc.config.sync = true;

function(data,socket){
console.log(arguments)
console.log(arguments);
}

@@ -41,0 +41,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'goodbye';
ipc.config.id = 'goodbye';
ipc.config.retry= 1500;

@@ -28,3 +28,3 @@ ipc.config.maxRetries= 10;

}
)
);
}

@@ -31,0 +31,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -28,3 +28,3 @@ ipc.config.maxRetries=10;

}
)
);
}

@@ -31,0 +31,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -17,3 +17,3 @@

hello:false
}
};

@@ -20,0 +20,0 @@ ipc.serveNet(

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -25,3 +25,3 @@ ipc.config.rawBuffer=true;

'hello'
)
);
}

@@ -28,0 +28,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -13,0 +13,0 @@ ipc.config.rawBuffer=true;

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -27,3 +27,3 @@ ipc.config.tls={

'hello'
)
);
}

@@ -30,0 +30,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -16,3 +16,3 @@ //node-ipc will default to its local certs

rejectUnauthorized:false
}
};

@@ -36,3 +36,3 @@ ipc.serveNet(

function(data,socket){
console.log(arguments)
console.log(arguments);
}

@@ -39,0 +39,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -32,3 +32,3 @@ ipc.config.tls={

'hello'
)
);
}

@@ -35,0 +35,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -22,3 +22,3 @@ ipc.config.tls={

]
}
};

@@ -42,3 +42,3 @@ ipc.serveNet(

function(data,socket){
console.log(arguments)
console.log(arguments);
}

@@ -45,0 +45,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -33,3 +33,3 @@ ipc.config.networkHost='localhost';

'hello'
)
);
}

@@ -36,0 +36,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -23,3 +23,3 @@ ipc.config.networkHost='localhost';

]
}
};

@@ -43,3 +43,3 @@ ipc.serveNet(

function(data,socket){
console.log(arguments)
console.log(arguments);
}

@@ -46,0 +46,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -27,3 +27,3 @@ ipc.config.tls={

'hello'
)
);
}

@@ -30,0 +30,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -16,3 +16,3 @@ ipc.config.tls={

private: __dirname+'/../../../local-node-ipc-certs/private/server.key'
}
};

@@ -36,3 +36,3 @@ ipc.serveNet(

function(data,socket){
console.log(arguments)
console.log(arguments);
}

@@ -39,0 +39,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -31,3 +31,3 @@ ipc.config.sync= true;

'hello'+i
)
);
}

@@ -34,0 +34,0 @@ }

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -17,3 +17,3 @@ ipc.config.sync= true;

private: __dirname+'/../../../local-node-ipc-certs/private/server.key'
}
};

@@ -42,3 +42,3 @@ ipc.serveNet(

function(data,socket){
console.log(arguments)
console.log(arguments);
}

@@ -45,0 +45,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'goodbye';
ipc.config.id = 'goodbye';
ipc.config.retry= 1500;

@@ -31,3 +31,3 @@ ipc.config.maxRetries= 10;

}
)
);
}

@@ -34,0 +34,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -31,3 +31,3 @@ ipc.config.maxRetries=10;

}
)
);
}

@@ -34,0 +34,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -16,3 +16,3 @@ ipc.config.tls={

private: __dirname+'/../../../local-node-ipc-certs/private/server.key'
}
};

@@ -22,3 +22,3 @@ var messages={

hello:false
}
};

@@ -25,0 +25,0 @@ ipc.serveNet(

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -35,3 +35,3 @@ ipc.config.rawBuffer=true;

'hello'
)
);
}

@@ -38,0 +38,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -26,3 +26,3 @@ ipc.config.rawBuffer=true;

]
}
};

@@ -29,0 +29,0 @@ ipc.serveNet(

var ipc=require('../../../node-ipc');
/***************************************\
*
*
* UDP Client is really a UDP server
*
* Dedicated UDP sockets on the same
*
* Dedicated UDP sockets on the same
* machine can not be bound to in the
* traditional client/server method
*
*
* Every UDP socket is it's own UDP server

@@ -15,10 +15,10 @@ * And so must have a unique port on its

* which can share on the same machine.
*
*
* Since there is no open client server
* relationship, you should start world
* first and then hello.
*
*
* *************************************/
ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -53,2 +53,2 @@

ipc.server.start();
ipc.server.start();

@@ -22,3 +22,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -25,0 +25,0 @@

@@ -18,3 +18,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'goodbye';
ipc.config.id = 'goodbye';
ipc.config.retry= 1500;

@@ -49,2 +49,2 @@

ipc.server.start();
ipc.server.start();

@@ -18,3 +18,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -49,2 +49,2 @@

ipc.server.start();
ipc.server.start();

@@ -18,3 +18,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -25,3 +25,3 @@

hello:false
}
};

@@ -65,2 +65,2 @@ ipc.serveNet(

ipc.server.start();
ipc.server.start();

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -13,0 +13,0 @@ ipc.config.rawBuffer=true;

@@ -22,3 +22,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -25,0 +25,0 @@ ipc.config.rawBuffer=true;

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry = 1000;

@@ -27,3 +27,3 @@

}
)
);
}

@@ -30,0 +30,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -13,0 +13,0 @@

@@ -10,5 +10,5 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry = 1000;
ipc.config.sync= true;
ipc.config.sync= true;

@@ -31,3 +31,3 @@ ipc.connectTo(

}
)
);
}

@@ -34,0 +34,0 @@ }

@@ -10,5 +10,5 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;
ipc.config.sync= true;
ipc.config.sync= true;

@@ -15,0 +15,0 @@ ipc.serve(

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'goodbye';
ipc.config.id = 'goodbye';
ipc.config.retry= 1500;

@@ -27,3 +27,3 @@

}
)
);
}

@@ -45,2 +45,2 @@ );

}
);
);

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -27,3 +27,3 @@

}
)
);
}

@@ -51,2 +51,2 @@ );

}
);
);

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -17,3 +17,3 @@

hello:false
}
};

@@ -20,0 +20,0 @@ ipc.serve(

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'hello';
ipc.config.id = 'hello';
ipc.config.retry= 1500;

@@ -25,3 +25,3 @@ ipc.config.rawBuffer=true;

'hello'
)
);
}

@@ -28,0 +28,0 @@ );

@@ -10,3 +10,3 @@ var ipc=require('../../../node-ipc');

ipc.config.id = 'world';
ipc.config.id = 'world';
ipc.config.retry= 1500;

@@ -13,0 +13,0 @@ ipc.config.rawBuffer=true;

@@ -1,308 +0,26 @@

var os = require('os'),
dns = require('dns'),
util = require('util'),
colors = require('colors'),
pubsub = require('event-pubsub'),
eventParser = require('./lib/eventParser.js'),
Client = require('./lib/client.js'),
Server = require('./lib/socketServer.js');
'use strict';
colors.setTheme(
{
good : 'green',
notice : 'yellow',
warn : 'red',
error : 'redBG',
debug : 'magenta',
variable: 'cyan',
data : 'blue'
}
);
const colors = require('colors'),
LogColors = require('./entities/LogColors.js'),
IPC = require('./services/IPC.js');
var IPType=os.networkInterfaces()[
Object.keys(os.networkInterfaces())[0]
][0].family
var defaults={
appspace : 'app.',
socketRoot : '/tmp/',
networkHost : (IPType=='IPv6')? '::1' : '127.0.0.1',
networkPort : 8000,
id : os.hostname(),
encoding : 'utf8',
rawBuffer : false,
sync : false,
silent : false,
maxConnections : 100,
retry : 500,
maxRetries : Infinity,
stopRetrying : false,
IPType : IPType,
tls : false
}
var ipc = {
config : defaults,
connectTo : connect,
connectToNet: connectNet,
disconnect : disconnect,
serve : serve,
serveNet : serveNet,
of : {},
server : false,
log : log
}
function log(){
if(ipc.config.silent)
return;
var args=Array.prototype.slice.call(arguments);
for(var i=0, count=args.length; i<count; i++){
if(typeof args[i] != 'object')
continue;
args[i]=util.inspect(args[i],{colors:true});
class IPCModule extends IPC{
constructor(){
super();
//include IPC to make extensible
Object.defineProperty(
this,
'IPC',
{
enumerable:true,
writable:false,
value:IPC
}
)
}
console.log(
args.join(' ')
);
}
function disconnect(id){
if(!ipc.of[id])
return;
ipc.of[id].config.stopRetrying=true;
colors.setTheme(new LogColors);
ipc.of[id].off('*');
if(ipc.of[id].socket){
if(ipc.of[id].socket.destroy)
ipc.of[id].socket.destroy();
}
delete ipc.of[id];
}
function serve(path,callback){
if(typeof path=='function'){
callback=path;
path=false;
}
if(!path){
ipc.log(
'Server path not specified, so defaulting to'.notice,
'ipc.config.socketRoot + ipc.config.appspace + ipc.config.id'.variable,
(ipc.config.socketRoot+ipc.config.appspace+ipc.config.id).data
);
path=ipc.config.socketRoot+ipc.config.appspace+ipc.config.id;
}
if(!callback)
callback=function(){};
ipc.server=new Server(
path,
ipc.config,
log
);
ipc.server.on(
'start',
callback
);
}
function serveNet(host,port,UDPType,callback){
if(typeof host=='number'){
callback=UDPType;
UDPType=port;
port=host;
host=false;
}
if(typeof host=='function'){
callback=host;
UDPType=false;
host=false;
port=false;
}
if(!host){
ipc.log(
'Server host not specified, so defaulting to'.notice,
'ipc.config.networkHost'.variable,
ipc.config.networkHost.data
);
host=ipc.config.networkHost;
}
if(host.toLowerCase()=='udp4' || host.toLowerCase()=='udp6'){
callback=port;
UDPType=host.toLowerCase();
port=false;
host=ipc.config.networkHost;
}
if(typeof port=='string'){
callback=UDPType;
UDPType=port;
port=false;
}
if(typeof port=='function'){
callback=port;
UDPType=false;
port=false;
}
if(!port){
ipc.log(
'Server port not specified, so defaulting to'.notice,
'ipc.config.networkPort'.variable,
ipc.config.networkPort
);
port=ipc.config.networkPort;
}
if(typeof UDPType=='function'){
callback=UDPType;
UDPType=false;
}
if(!callback)
callback=function(){};
ipc.server=new Server(
host,
ipc.config,
log,
port
);
if(UDPType)
ipc.server[UDPType]=true;
ipc.server.on(
'start',
callback
);
}
function connect(id,path,callback){
if(typeof path == 'function'){
callback=path;
path=false;
}
if(!callback)
callback=function(){};
if(!id){
ipc.log(
'Service id required'.warn,
'Requested service connection without specifying service id. Aborting connection attempt'.notice
);
return;
}
if(!path){
ipc.log(
'Service path not specified, so defaulting to'.notice,
'ipc.config.socketRoot + ipc.config.appspace + id'.variable,
(ipc.config.socketRoot+ipc.config.appspace+id).data
);
path=ipc.config.socketRoot+ipc.config.appspace+id;
}
if(ipc.of[id]){
if(!ipc.of[id].socket.destroyed){
ipc.log(
'Already Connected to'.notice,
id.variable,
'- So executing success without connection'.notice
);
callback();
return;
}
ipc.of[id].socket.destroy();
}
ipc.of[id] = new Client(ipc.config,ipc.log);
ipc.of[id].id = id;
ipc.of[id].path = path;
ipc.of[id].connect();
callback(ipc);
}
function connectNet(id,host,port,callback){
if(!id){
ipc.log(
'Service id required'.warn,
'Requested service connection without specifying service id. Aborting connection attempt'.notice
);
return;
}
if(typeof host=='number'){
callback=port;
port=host;
host=false;
}
if(typeof host=='function'){
callback=host;
host=false;
port=false;
}
if(!host){
ipc.log(
'Server host not specified, so defaulting to'.notice,
'ipc.config.networkHost'.variable,
ipc.config.networkHost.data
);
host=ipc.config.networkHost;
}
if(typeof port=='function'){
callback=port;
port=false;
}
if(!port){
ipc.log(
'Server port not specified, so defaulting to'.notice,
'ipc.config.networkPort'.variable,
ipc.config.networkPort
);
port=ipc.config.networkPort;
}
if(typeof callback == 'string'){
UDPType=callback;
callback=false;
}
if(!callback)
callback=function(){};
if(ipc.of[id]){
if(!ipc.of[id].socket.destroyed){
ipc.log(
'Already Connected to'.notice,
id.variable,
'- So executing success without connection'.notice
);
callback();
return;
}
ipc.of[id].socket.destroy();
}
ipc.of[id] = new Client(ipc.config,ipc.log);
ipc.of[id].id = id;
ipc.of[id].path = host;
ipc.of[id].port = port;
ipc.of[id].connect();
callback(ipc);
}
module.exports=ipc;
module.exports=new IPCModule;
{
"name": "node-ipc",
"version": "5.2.0",
"version": "6.0.0",
"description": "A nodejs module for local and remote Inter Process Communication (IPC), Neural Networking, and able to facilitate machine learning.",

@@ -19,6 +19,17 @@ "main": "node-ipc.js",

},
"devDependencies": {},
"devDependencies": {
"blanket": "^1.2.1",
"codacy-coverage": "^1.1.3",
"jasmine": "^2.4.1",
"istanbul": "^0.4.1",
"codacy-coverage": "^1.1.3"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "istanbul cover -x **/spec/** -dir ./spec/coverage jasmine",
"cover": "istanbul cover -x **/spec/** -dir ./spec/coverage jasmine",
"coverup": "cat ./spec/coverage/lcov.info | codacy-coverage"
},
"pre-commit": [
"cover"
],
"keywords": [

@@ -25,0 +36,0 @@ "IPC",

node-ipc
================
*a nodejs module for local and remote Inter Process Communication* with full support for Linux, Mac and Windows.
A great solution for **Neural Networking** in Node.JS
*a nodejs module for local and remote Inter Process Communication* with full support for Linux, Mac and Windows. It also supports all forms of socket communication from low level unix and windows sockets to UDP and secure TLS and TCP sockets.
A great solution for complex multiprocess **Neural Networking** in Node.JS
**npm install node-ipc**
#### NPM Stats

@@ -19,2 +21,5 @@ npm info : [See npm trends and stats for node-ipc](http://npm-stat.com/charts.html?package=node-ipc&author=&from=&to=)

Codacy info :
[![Codacy Badge](https://api.codacy.com/project/badge/grade/8e0294dff55f4ac1985c07b16f39d0a9)](https://www.codacy.com/app/RIAEvangelist/node-ipc) [![Codacy Badge](https://api.codacy.com/project/badge/coverage/8e0294dff55f4ac1985c07b16f39d0a9)](https://www.codacy.com/app/RIAEvangelist/node-ipc)
Package details websites :

@@ -26,2 +31,8 @@ * [GitHub.io site](http://riaevangelist.github.io/node-ipc/ "node-ipc documentation"). A prettier version of this site.

#### Testing
` npm test ` will run the jasmine tests with istanbul for node-ipc and generate a coverage report in the spec folder.
You may want to install jasmine and istanbul globally with ` sudo npm install -g jasmine istanbul `
----

@@ -28,0 +39,0 @@ #### Contents

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