0.0.4 • Published 8 months ago

jsonrpc-bridge v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

jsonrpc-bridge

Remote procedure call (RPC) library for JavaScript. It is based on JSON-RPC 2.0 specification.

Installation

npm install --save jsonrpc-bridge

Usage

Server side

import * as testModule from './testModule';

const serverChannel: JSONRPCServerChannel = ...;
const server = new JSONRPCServer(serverChannel, { debug: true });
server.addModule('testModule', modules);

Client side

const clientChannel: JSONRPCClientChannel = ...;
const client = new JSONRPCClient<typeof modules>(clientChannel, { debug: true });

const res = await client.call.testModule.testMethod('test', 123) // call remote method
client.notify.testModule.testMethod('test', 123) // call remote method without response
0.0.3

8 months ago

0.0.2

8 months ago

0.0.4

8 months ago

0.0.1

8 months ago