1.0.0 • Published 5 years ago

@itemsjs/json-rpc-client v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

JSON RPC client

Wrap all your application-level services

NPM version NPM downloads

Installation

npm i @itemsjs/json-rpc-client --save

Usage

const JsonRpcClient = require('@itemsjs/json-rpc-client');

const rpcClient = new JsonRpcClient({
    // exactly same as jayson HTTP client config
});

// notify
rpcClient.notify('your-event-name', {
    p1: 123,
    name: 'My name'
});


// command
let result = await rpcClient.command('add', {
    a: 1,
    b: 2
});

And you're good to go!

License

MIT

1.0.0

5 years ago