@observable-rpc/client v0.1.5
@observable-rpc/client
Creates a router that accepts WebSocket requests for methods to be run on the server.
Use the @observable-rpc/router package to determine what methods will be exposed to the browser.
API
ObservableRpcClient(url)
import { ObservableRpcClient } from '@observable-rpc/client'
const client = new ObservableRpcClient(options)Wraps a Socket.IO client to send requests to the server and handle responses.
options
options.url:StringThe protocol+hostname+port+path the
ObservableRpcClientshould use to talk to theObservableRpcRouter. When run in the browser this will default to the current protocol+host+port and the path/rpc.options.consumeLog$:(log$) => voidBy default log messages from
ObservableRpcRouterare handled withdebug. Pass a consumeLog$ function to receive a stream of log events to handle them yourself. Log events have the following properties:level: 'error'|'info'|'debug': The level for the log messagemsg: String: The log message, probably pretty shortdata: any: Metadata relevant to the specific log message
methods
ObservableRpcClient#call(method, params): ObservableCall a method on the server. Returns an
Observable(from RxJS 6) that mirrors the values/errors/completion of the observable from the server