hobby-rpc
v0.2.1
Published
A Hobby-RPC client for browsers
Readme
It is a Hobby-RPC client for browsers and Node.js, using the built-in Fetch API. To install:
npm i hobby-rpcA usage example:
import { RPC } from 'hobby-rpc'
rpc = RPC
url: 'https://some.domain'
token: 'authorization token'
output = await rpc 'SomeNullaryFunction'
output = await rpc 'SomeUnaryFunction', inputinput can be any object serializable to JSON.
It will be passed to the remote function as an argument.
The remote server at https://some.domain is expected to implement
SomeNullaryFunction and SomeUnaryFunction.
output would be an object deserialized from JSON.
This client works only via TCP sockets. Other client works via Unix sockets too.
