1.0.5 • Published 6 years ago

netpipe v1.0.5

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

NetPipe

This module created in order to support communication between services in Micro Services architecture . In that case, almost service was located on separated machines.

Netpipe uses socket.io and socket.io-client to make a connection from event host and event listener.

Installation

$ npm i --save netpipe

Netpipe uses socket.io and socket.io-client to make a connection from event host and event listener.

Testing

Run the testing command :

$ npm test

Usage

For example, collector is a module that request and update real-time data from all exchanges. When it gots new exchange's feed (ohcl). It will trigger an event to inform to all listeners :

let event = new NetworkEvent();
event.setNetworkName('collector').setEnv('development');
event.registerEvent('newFeed').then((result) => {
   //Event registered successfully
});
//Get OHCL from and exchange
onGetNewFeedSuccess().then((feed) => {
    event.triggerEvent('newFeed', {feed : feed});
})

Next, analytics is a module which always wait for exchange feed update and recalculate new indicator values. It needs listen newfeed event of collector module.

let event = new NetworkEvent();
event.setNetworkName('analytics');
event.addListener('collector', 'newFeed', function(feed) {
    //New feed received. Start recalculate...
});
1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago