nanoservice
v2.0.0
Published
Module for agile interservice-communication with support many transports
Downloads
32
Readme
#NanoService
Module for agile interservice-communication with support different transports (like as socket). Every service can has many in
and out
links. Every link can has many connections by different transport (example, socket-client or socket-server), create another services and environment.
#Example import nanoservice from("nanoservice"); //Add transport with any name const transportIPCServer = require("nanoservice-transport-ipc-server"); class Service1 extends EventEmitter { constructor(args){ super(); this.on("in1", (data)=>{ setTimeout(()=>{ this.emit("test1"); }, 100); }); } } // Create transport const transport = transportIPCServer({ address: "sock" }); // Define links // All calls to out1 will be transported to ipc-server with address "sock" on emit-name "event1" const links = [ { transport: transport, type: "out", name: "out1", to: "event1" } ]; const config = { links }; nanoservice(service, config)
#Transports
Internal transport: https://github.com/arvitaly/nanoservice-transport-internal
IPC transports: https://github.com/arvitaly/nanoservice-transport-ipc-client, https://github.com/arvitaly/nanoservice-transport-ipc-server