1.1.1 • Published 6 months ago

@startier/ohrid-jsonrpc-driver v1.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

@startier/ohrid-jsonrpc-driver

A driver for @startier/ohrid that resolves method calls with a server/client architecture using JSON-RPC 2.0 for communication.

Usage

Install the package using npm (or anything compatible):

npm install @startier/ohrid-jsonrpc-driver

Add the driver to services.json.

Global

{
  "driver": "@startier/ohrid-jsonrpc-driver"
}

Service-specific

{
  "services": {
    "example": {
      "driver": "@startier/ohrid-jsonrpc-driver",
      "settings": {}
    }
  }
}

Settings

{
    hub?: boolean,
    port?: number,
    address?: string,
    transport?: "unix" | "tcp" | "websocket" | "socket.io",
    remoteHub?: string
}

transport

The transport layer that will be used by the node.

remoteHub

The server node that the node should connect to.

Different format is needed for different transport:

  • unix: unix socket file path
  • tcp: tcp://host:port
  • websocket: ws://host:port
  • socket.io: http://host:port

hub

When set to true this node will be considered a server and will listen for connections.

  • Requires (except for transport: unix): port
  • Requires (for transport: unix): address

port

The port that gets used when the node is considered a server.

address

The file path that gets used when the node is considered a server and uses unix transport.