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.0.2 to 0.9.0

example/remote/basic/hello-client.js

4

example/local/basic/hello-client.js

@@ -39,2 +39,4 @@ var ipc=require('../../../node-ipc');

}
);
);
console.log(ipc)

@@ -28,2 +28,4 @@ var ipc=require('../../../node-ipc');

ipc.server.define.listen.message='This event type listens for message strings as value of data key.';
ipc.server.start();

@@ -42,7 +42,16 @@ var net = require('net'),

client.socket = net.connect(
{
path:client.path
}
);
if(!client.port){
client.socket = net.connect(
{
path:client.path
}
);
}else{
client.socket = net.connect(
{
port:client.port,
host:client.path
}
);
}

@@ -49,0 +58,0 @@ client.socket.setEncoding(this.config.encoding);

@@ -39,6 +39,7 @@ var net = require('net'),

function init(path,config,log){
function init(path,config,log,port){
var server={
config : config,
path : path,
port : port,
log : log,

@@ -76,3 +77,3 @@ server : false,

return function () {
server.log('starting server on '.debug,server.path.variable);
server.log('starting server on '.debug,server.path.variable,((server.port)?':'+server.port:'').variable);
server.server=net.createServer(

@@ -136,16 +137,21 @@ function(socket) {

function started(socket){
server.onStart(socket)
}
if(!port){
server.server.listen(
server.path,
started
);
server.server.maxConnections=server.maxConnections;
return;
}
server.server.listen(
server.port,
server.path,
(
function(server){
return function(socket){
server.onStart(socket)
}
}
)(server)
started
);
server.server.maxConnections=server.maxConnections;
}

@@ -152,0 +158,0 @@ }

@@ -25,2 +25,4 @@ var os = require('os'),

socketRoot : '/tmp/',
networkHost : 'localhost',
networkPort : 8000,
id : os.hostname(),

@@ -36,3 +38,5 @@ encoding : 'utf8',

connectTo : connect,
connectToTCP: connectTCP,
serve : serve,
serveTCP : serveTCP,
of : {},

@@ -66,2 +70,5 @@ server : false,

if(!callback)
callback=function(){};
ipc.server=new Server(

@@ -79,2 +86,49 @@ path,

function serveTCP(host,port,callback){
if(typeof host=='number'){
callback=port;
port=host;
host=false;
}
if(typeof host=='function'){
callback=host;
host=false;
port=false;
}
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(!host){
ipc.log(
'Server host not specified, so defaulting to'.notice,
'ipc.config.networkHost'.variable,
ipc.config.networkHost.data
);
host=ipc.config.networkHost;
}
if(!callback)
callback=function(){};
ipc.server=new Server(
host,
ipc.config,
log,
port
);
ipc.server.on(
'start',
callback
);
}
function connect(id,path,callback){

@@ -128,2 +182,67 @@ if(typeof path == 'function'){

function connectTCP(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(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(!host){
ipc.log(
'Server host not specified, so defaulting to'.notice,
'ipc.config.networkHost'.variable,
ipc.config.networkHost.data
);
host=ipc.config.networkHost;
}
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].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();
}
module.exports=ipc;
{
"name": "node-ipc",
"version": "0.0.2",
"version": "0.9.0",
"description": "A nodejs module for local and remote Inter Process Communication (IPC) uses Unix Sockets for local communication avoiding the network card for lower overhead and latency. ## Solid but, ### Still under development and lacking documentation, but useable.",

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

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