Gathering detailed insights and metrics for @open-rpc/client-js
Gathering detailed insights and metrics for @open-rpc/client-js
Gathering detailed insights and metrics for @open-rpc/client-js
Gathering detailed insights and metrics for @open-rpc/client-js
npm install @open-rpc/client-js
59.9
Supply Chain
99.1
Quality
78.1
Maintenance
100
Vulnerability
100
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
123 Stars
511 Commits
13 Forks
5 Watching
26 Branches
12 Contributors
Updated on 03 Nov 2024
Minified
Minified + Gzipped
TypeScript (98.04%)
HTML (1.08%)
JavaScript (0.88%)
Cumulative downloads
Total Downloads
Last day
32.9%
11,040
Compared to previous day
Last week
15.5%
53,862
Compared to previous week
Last month
11.3%
191,622
Compared to previous month
Last year
15%
1,580,364
Compared to previous year
A browser-compatible JSON-RPC client with multiple transports:
1import { RequestManager, HTTPTransport, Client } from "@open-rpc/client-js"; 2const transport = new HTTPTransport("http://localhost:8545"); 3const client = new Client(new RequestManager([transport])); 4const result = await client.request({method: "addition", params: [2, 2]}); 5// => { jsonrpc: '2.0', id: 1, result: 4 }
1import { EventEmitter } from "events"; 2import { RequestManager, EventEmitterTransport, Client } from "@open-rpc/client-js"; 3 4const chan1 = "chan1"; 5const chan2 = "chan2"; 6 7const emitter = new EventEmitter(); 8const transport = new EventEmitterTransport(emitter, chan1, chan2); 9const requestManager = new RequestManager([transport]); 10const client = new Client(requestManager); 11 12// event emitter server code 13emitter.on(chan1, (jsonrpcRequest) => { 14 const res = { 15 jsonrpc: "2.0", 16 result: "potato", 17 id: jsonrpcRequest.id, 18 }; 19 emitter.emit(chan2, JSON.stringify(res)); 20}); 21 22const main = async () => { 23 const result = await client.request({method: "addition", params: [2, 2]}); 24 console.log(result); 25}; 26 27main().then(() => { 28 console.log("DONE"); 29});
1import { RequestManager, Client, HTTPTransport } from "@open-rpc/client-js"; 2 3const transport = new HTTPTransport("http://localhost:3333"); 4const requestManager = new RequestManager([transport]); 5const client = new Client(requestManager); 6 7const main = async () => { 8 const result = await client.request({method: "addition", params: [2, 2]}); 9 console.log(result); 10}; 11 12main().then(() => { 13 console.log("DONE"); 14});
1import { RequestManager, Client, WebSocketTransport } from "@open-rpc/client-js"; 2 3const transport = new WebSocketTransport("ws://localhost:3333"); 4const requestManager = new RequestManager([transport]); 5const client = new Client(requestManager); 6 7const main = async () => { 8 const result = await client.request({method: "addition", params: [2, 2]}); 9 console.log(result); 10}; 11 12main().then(() => { 13 console.log("DONE"); 14 client.close(); 15}); 16
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.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 2/9 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
21 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More