OpenRPC Client JS
A browser-compatible JSON-RPC client with multiple transports:
- EventEmitter
- HTTP/HTTPS
- WebSocket
- PostMessageWindow
- PostMessageIframe
;const transport = "http://localhost:8545";const client = transport;const result = await client;// => { jsonrpc: '2.0', id: 1, result: 4 }
Examples
EventEmitter
;; const chan1 = "chan1";const chan2 = "chan2"; const emitter = ;const transport = emitter chan1 chan2;const requestManager = transport;const client = requestManager; // event emitter server codeemitter; const main = async { const result = await client; console;}; ;
HTTP
; const transport = "http://localhost:3333";const requestManager = transport;const client = requestManager; const main = async { const result = await client; console;}; ;
WebSocket
; const transport = "ws://localhost:3333";const requestManager = transport;const client = requestManager; const main = async { const result = await client; console;}; ;
Contributing
How to contribute, build and release are outlined in CONTRIBUTING.md, BUILDING.md and RELEASING.md respectively. Commits in this repository follow the CONVENTIONAL_COMMITS.md specification.