A jsonrpc client over websocket, supports promise and rxjs
- jsonrpc v2.0
- browser and nodejs
- Promise/Rxjs client
- auto reconnect
const {JsonRpcClient} = require('jsonrpc-wsc')
const client = new JsonRpcClient('ws://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://localhost:9944', client => {
return client.send('some method')
})
const {JsonRpcRxClient} = require('jsonrpc-wsc')
const client = new JsonRpcRxClient('ws://localhost:9944')
client.send('some method').subscribe(result => {
console.log('result', result)
client.destroy()
})