Gathering detailed insights and metrics for rockets-client
Gathering detailed insights and metrics for rockets-client
Gathering detailed insights and metrics for rockets-client
Gathering detailed insights and metrics for rockets-client
rockets
Server-side client for rockets/rockets
rocket-launch-live-client
A Node.JS client for interacting with the RocketLaunch.Live API
rockets-slack
Slack integration client for rockets/rockets
@rocketsoftware/eureka-js-client
A JavaScript implementation the Netflix OSS service registry, Eureka.
npm install rockets-client
Typescript
Module System
Min. Node Version
Node Version
NPM Version
C++ (82.67%)
TypeScript (10.69%)
Python (5.39%)
CMake (0.67%)
Makefile (0.29%)
JavaScript (0.22%)
Shell (0.07%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
LGPL-3.0 License
38 Stars
115 Commits
9 Forks
13 Watchers
37 Branches
17 Contributors
Updated on Aug 19, 2024
Latest Version
1.0.0
Package Id
rockets-client@1.0.0
Unpacked Size
305.89 kB
Size
71.11 kB
File Count
80
NPM Version
6.4.1
Node Version
8.15.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
3
1
25
A small client for Rockets using JSON RPC as communication contract over a WebSocket.
You can install this package from NPM:
1npm add rxjs rockets-client
Or with Yarn:
1yarn add rxjs rockets-client
For CDN, you can use unpkg:
https://unpkg.com/rockets-client/dist/bundles/rockets-client.umd.min.js
The global namespace for rockets is rocketsClient
:
1const {Client} = rocketsClient; 2 3const rockets = new Client({ 4 url: 'myhost' 5});
Create a client and connect:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({ 4 url: 'myhost', 5 onConnected() { 6 console.info('I just connected'); 7 }, 8 onClosed(evt) { 9 console.log(`Socket connection closed with code ${evt.code}`); 10 } 11});
Close the connection with the socket cleanly:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5rockets.subscribe({ 6 next(notification) { 7 console.log(notification); 8 }, 9 complete() { 10 console.log('Socket connection closed'); 11 } 12}); 13 14rockets.disconnect();
Listen to server notifications:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5rockets.subscribe(notification => { 6 console.log(notification); 7});
Send notifications:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5rockets.notify('mymethod', { 6 ping: true 7});
Send a notification using the Notification
object:
1import {Client, Notification} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5const notification = new Notification('mymethod', { 6 ping: true 7}); 8rockets.notify(notification);
Make a request:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5const response = await rockets.request('mymethod', { 6 ping: true 7}); 8console.log(response);
NOTE: There is no need to wait for a connection to be established with the socket as requests will be buffered and sent once the connection is alive. In case of a socket error, the request promise will reject. The same is true for batch requests and notifications.
Or make a request using the Request
object:
1import {Client, Request} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5const request = new Request('mymethod', { 6 ping: true 7}); 8const response = await rockets.request(request); 9console.log(response);
Handle a request error:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5try { 6 await rockets.request('mymethod'); 7} catch (err) { 8 console.log(err.code); 9 console.log(err.message); 10 console.log(err.data); 11}
NOTE: Any error that may occur will be a JsonRpcError
.
Cancel a request:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5const task = rockets.request('mymethod'); 6task.cancel();
Get progress updates for a request:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5const task = rockets.request('mymethod'); 6task.on('progress') 7 .subscribe(progress => { 8 console.log(progress); 9 });
Make a batch request:
1import {Client, Notification, Request} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5const request = new Request('mymethod'); 6const notification = new Notification('mymethod'); 7const [response] = await rockets.batch(...[ 8 request, 9 notification 10]); 11 12const result = await response.json(); 13console.log(result);
NOTE: Notifications will not return any responses and if no requests are sent, the batch request will resolve without any arguments.
Handle a batch request error:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5try { 6 const request = new Request('mymethod'); 7 await rockets.batch(request); 8} catch (err) { 9 console.log(err.code); 10 console.log(err.message); 11 console.log(err.data); 12}
NOTE: The batch promise will not reject for response errors, but you can catch the response error when using the response .json()
method:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5try { 6 const request = new Request('mymethod'); 7 const [response] = await rockets.batch(request); 8 await response.json(); 9} catch (err) { 10 console.log(err.code); 11 console.log(err.message); 12 console.log(err.data); 13}
Cancel a batch request:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5const request = new Request('mymethod'); 6const task = rockets.batch(request); 7 8task.cancel();
NOTE: Notifications cannot be canceled.
Get progress updates for a batch request:
1import {Client} from 'rockets-client'; 2 3const rockets = new Client({url: 'myhost'}); 4 5const request = new Request('mymethod'); 6const task = rockets.batch(request); 7 8task.on('progress') 9 .subscribe(progress => { 10 console.log(progress); 11 });
If you're a contributor and wish to make a release of this package use:
1# Cut a minor release 2# A release can be: patch, minor, major; 3yarn release --release-as minor
See release as a target type imperatively like npm-version for more release options.
After the changes land in master, the new version will be automatically published by the CI.
IMPORTANT: Follow the semver for versioning.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 16/21 approved changesets -- score normalized to 7
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
93 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
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