json-rpc-request

JSON RPC 2.0 request object constructor.

Usage no npm install needed!

<script type="module">
  import jsonRpcRequest from 'https://cdn.skypack.dev/json-rpc-request';
</script>

README

JSON RPC 2.0 Request

Constructor for JSON RPC 2.0 request objects.

Also see related packages json-rpc-response, json-rpc-notification, and json-rpc-error

Installation

npm install json-rpc-request

Usage

new JsonRpcRequest(id, method[, params]);

Request objects can be constructed with or without using the new keyword.

Example

var JsonRpcRequest = require('json-rpc-request');

// Request with params
new JsonRpcRequest(1, 'subtract', [42, 23]);

// Request without params
new JsonRpcRequest(2, 'ping');

Test

Run unit tests;

$ npm test

License

MIT