0.2.7 • Published 6 years ago

squiddy v0.2.7

Weekly downloads
1
License
ISC
Repository
-
Last release
6 years ago

ipc network for microservices on local machine (unix sockets)

Install

$ npm install squiddy

Usage

run the hub process

$ node node_modules/squiddy/hub.js

instantiate a link in a process to make it a client

const ServiceLink = require('squiddy').link
const link = new ServiceLink("this-service")

link.connect()
.then(() => link.waitFor("another-service"))
.then(() => {
	console.log("found another-service")
})

create a request method

link.addRequestMethod("my-request-method", executeFunction)

(function can syncronous or asyncronous)

call a request method

link.request("another-service", "my-request-method")
.then(response => {
})

or, with arguments:

link.request("another-service", {
	method: "my-request-method",
	args: [...myArgs]
})

create a channel

link.createChannel("myChannel", onSubscribeFunction)

broadcast from a channel

link.broadcast("myChannel", channelMessage, specificSubscriber)
// if specificSubscriber is undefined then this broadcasts to all subscribers

subscribe to a channel

link.subscribe("another-service", "myChannel", callback)

or, for multiple actions for a subscription:

link.onChannelMessage("another-service", "myChannel", callback1)
link.onChannelMessage("another-service", "myChannel", callback2)

License

MIT

0.2.7

6 years ago

0.2.6

6 years ago

0.2.5

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago