Skip to content

A jsonrpc client over websocket, supports promise and rxjs

License

Notifications You must be signed in to change notification settings

ianhe8x/wsjsonrpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsonrpc-wsc

A jsonrpc client over websocket, supports promise and rxjs

Supports

  • jsonrpc v2.0
  • browser and nodejs
  • Promise/Rxjs client
  • auto reconnect

Usage

Promise

const {JsonRpcClient} = require('jsonrpc-wsc')
const client = new JsonRpcClient('ws:https://localhost:9944')
const result = await client.send('some method')
console.log('result', result)
client.destroy()
// or disconnect after send()
const result = await JsonRpcClient.with('ws:https://localhost:9944', client => {
  return client.send('some method')
})

Rxjs

const {JsonRpcRxClient} = require('jsonrpc-wsc')
const client = new JsonRpcRxClient('ws:https://localhost:9944')
client.send('some method').subscribe(result => {
    console.log('result', result)
    client.destroy()
})

About

A jsonrpc client over websocket, supports promise and rxjs

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published