Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 4.1.0 to 5.0.0

example/TCPSocket/basicSync/hello-client.js

10

example/TCPSocket/basic/world-server.js
var ipc=require('../../../node-ipc');
/***************************************\
*
*
* You should start both hello and world
* then you will see them communicating.
*
*
* *************************************/

@@ -26,3 +26,3 @@

);
ipc.server.on(

@@ -37,4 +37,2 @@ 'socket.disconnected',

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

10

example/TCPSocket/Multi-Client-Broadcast/world-server.js
var ipc=require('../../../node-ipc');
/***************************************\
*
*
* You should start both hello and world
* then you will see them communicating.
*
*
* *************************************/

@@ -33,3 +33,3 @@

);
if(messages.hello && messages.goodbye){

@@ -49,5 +49,5 @@ ipc.log('got all required events, telling clients to kill connection'.good);

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();

@@ -40,4 +40,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();

@@ -46,4 +46,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();

@@ -47,4 +47,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();

@@ -40,4 +40,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();

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

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();

@@ -50,4 +50,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();

@@ -46,4 +46,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();

@@ -46,4 +46,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();

@@ -46,4 +46,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();

@@ -61,4 +61,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();

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

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

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

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();

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

Message = require('js-message'),
fs = require('fs');
fs = require('fs'),
Queue = require('js-queue');

@@ -12,2 +13,3 @@ function init(config,log){

config : config,
queue : new Queue,
socket : false,

@@ -37,5 +39,17 @@ connect : connect,

this.socket.write(message);
if(!this.config.sync){
this.socket.write(message);
return;
}
this.queue.add(
syncEmit.bind(this,message)
);
};
function syncEmit(message){
this.log('dispatching event to '.debug, this.id.variable, this.path.variable,' : ', message.data);
this.socket.write(message);
}
function connect(){

@@ -182,2 +196,7 @@ //init client object for scope persistance especially inside of socket events.

);
if(!client.config.sync){
return;
}
client.queue.next();
return;

@@ -210,2 +229,8 @@ }

}
if(!client.config.sync){
return;
}
client.queue.next();
}

@@ -212,0 +237,0 @@ );

@@ -75,12 +75,2 @@ var net = require('net'),

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){

@@ -270,12 +260,2 @@ this.trigger(

}
server.trigger(
'get.events.broadcasting',
socket
);
server.trigger(
'get.events.listening',
socket
);
}

@@ -336,30 +316,2 @@

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',

@@ -366,0 +318,0 @@ function(){

@@ -34,2 +34,3 @@ var os = require('os'),

rawBuffer : false,
sync : false,
silent : false,

@@ -36,0 +37,0 @@ maxConnections : 100,

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

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

},
"engines": {
"node": ">=1.0.0"
},
"dependencies": {

@@ -14,2 +17,3 @@ "colors": "*",

"js-message": "*",
"js-queue": "^0.1.2",
"node-cmd": "*"

@@ -16,0 +20,0 @@ },

@@ -9,3 +9,4 @@ node-ipc

npm info : [See npm trends and stats for node-ipc](http://npm-stat.com/charts.html?package=node-ipc&author=&from=&to=)
npm info : [See npm trends and stats for node-ipc](http://npm-stat.com/charts.html?package=node-ipc&author=&from=&to=)
[![NPM](https://nodei.co/npm/node-ipc.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/node-ipc/)
![node-ipc npm version](https://img.shields.io/npm/v/node-ipc.svg) ![supported node version for node-ipc](https://img.shields.io/node/v/node-ipc.svg) ![total npm downloads for node-ipc](https://img.shields.io/npm/dt/node-ipc.svg) ![monthly npm downloads for node-ipc](https://img.shields.io/npm/dm/node-ipc.svg) ![npm licence for node-ipc](https://img.shields.io/npm/l/node-ipc.svg)

@@ -36,3 +37,4 @@

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)

@@ -42,4 +44,4 @@ 2. [Client for Unix||Windows Sockets & TCP Sockets](#client-for-unix-sockets--tcp-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)

@@ -79,2 +81,3 @@

rawBuffer : false,
sync : false,
silent : false,

@@ -98,2 +101,3 @@ maxConnections : 100,

| 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. |
| silent | turn on/off logging default is false which means logging is on |

@@ -445,2 +449,16 @@ | 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. |

----
### 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.|
|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}} ` |
||||
----
### Basic Examples

@@ -467,3 +485,4 @@ 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.

socket,
'message',
'message', //this can be anything you want so long as
//your client knows.
data+' world!'

@@ -498,3 +517,3 @@ );

ipc.of.world.emit(
'message',
'message', //any event or message type your server listens for
'hello'

@@ -511,3 +530,3 @@ )

ipc.of.world.on(
'message',
'message', //any event or message type your server listens for
function(data){

@@ -561,4 +580,2 @@ ipc.log('got a message from world : '.debug, data);

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

@@ -601,4 +618,2 @@

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

@@ -605,0 +620,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