@ubio/intercomm
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

ProtoComm — bi-directional RPC + events microframework

Status: work-in-progress, use at your own risk.

Facilitates transparent bi-directional communication between services. Works in Node.js and Browser (over WebSocket).

Features

  • shared message and service definitions in JSON Schema format
  • transparent access: clients just invoke methods and subscribe to events as if the service was a class within the same process/runtime
  • transport is abstracted away from business logic
  • no reliance on code generation (unlike Protobuf toolset)
  • transport-agnostic; built for WebSockets in mind, but can work with IPC, TCP (albeit custom framing required)

How to use

Let's use Chat Service from tests as a motivational example.

  • ChatServiceDef is a service definition which is shared across Server and Client
  • On server side, ChatSession implements ChatServiceDef interface per connected client.
  • On client side, ServiceClient creates a stub using the shared service def. Conceptually, each client "talks" to its session.
  • Finally, on server side ChatServer sets up the WebSocket server, hooks it up with the transport and creates a service registry.
  • The tests demonstrate how messages are delivered both in RPC style (response delivered to the client who sent the request) and in Event-driven style.

Package Sidebar

Install

npm i @ubio/intercomm

Weekly Downloads

0

Version

0.1.0

License

ISC

Unpacked Size

18.8 kB

Total Files

16

Last publish

Collaborators

  • danielolaviobr
  • hyuko21
  • dleibner
  • mihon
  • khard
  • inca
  • randunel
  • alisapsee
  • nicck
  • andrew-waters
  • anatoliy
  • mgubio