Skip to content

Takeafile/jsonrpc-hub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status Coverage Status Greenkeeper badge

JsonRPC hub

This server allow to relay bidirectional JsonRPC messages between clients connected to it. The protocol use a extension of the standard JsonRPC 2.0 with the addition of a to field to indicate the identifier of the destination client. This makes it transparent to the parameters given to the calls. It also provides support to send messages in broadcast by setting null as its value.

How it works

This module export a function that when called will generate a handler function for the connection event of the WebSocket server objects created with the ws module.

Internally, connections are registered so incoming data can be send to the corresponding destination. Destination is identified with a to field, besides that data are plain JsonRPC messages.

Install

npm install jsonrpc-hub

API

  • options
    • allowBroadcast: enable to send messages to all the other connections
    • getId: function to get the connection identifier. By default, it's used the connection url.
    • timeout: milliseconds before a request is responsed as failed. Disabled by default

CLI

cli makes use of unify-config, so all the API options are available as command line arguments or environment variables.

jsonrpc-hub --allowBroadcast --timeout 5000

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published