hobby-rpc.client
v0.0.3
Published
left as an exercise to the reader
Readme
It is a Hobby-RPC client for Node.js, using the built-in http.request. To install:
npm i hobby-rpc.clientA usage example:
import { RPC } from 'hobby-rpc.client'
rpc = RPC
url: 'https://some.domain'
token: 'authorization token'
# or
rpc = RPC
socket: '/tmp/some_rpc.socket'
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.
output would be an object deserialized from JSON.
It can connect either via a TCP socket(if you pass its address in url) or
via a Unix socket(if you pass its filesystem path in socket).
This client is for Node.js. Other client uses an underlying mechanism available in browsers too.
