RPC Docs.

Prim+RPC is prerelease software. It may be unstable and functionality may change prior to full release.

Client Plugins

These are the currently supported plugins for Prim+RPC. For each Prim+RPC client instance you may choose one method plugin and one callback plugin (see Plugin Type in tables below). Remember that for each plugin on the client you must also specify a compatible handler on the server. For plugins/handlers to be compatible they must use the same type of transport (given in Transport Type in tables below).

Table of Contents

Fetch API (Browser)

ForPlugin TypeTransport Type
Fetch APIMethod pluginHTTP

You can use the Fetch API to send Prim+RPC requests (method calls) like so:


import { createPrimClient } from "@doseofted/prim-rpc"
import { createMethodPlugin } from "@doseofted/prim-rpc-plugins/browser-fetch"
const methodPlugin = createMethodPlugin()
const client = createPrimClient({ methodPlugin })

Remember to set the .endpoint so the plugin knows where the server is located.

WebSocket API (Browser)

ForPlugin TypeTransport Type
WebSocket APICallback pluginWebSocket

You can use the WebSocket API to send Prim+RPC requests (method calls with callbacks) like so:


import { createPrimClient } from "@doseofted/prim-rpc"
import { createCallbackPlugin } from "@doseofted/prim-rpc-plugins/browser-websocket"
const callbackPlugin = createCallbackPlugin()
const client = createPrimClient({ callbackPlugin })

Remember to set the .wsEndpoint so the plugin knows where the server is located.

Axios

ForPlugin TypeTransport Type
AxiosMethod pluginHTTP

Unavailable (planned)

Socket.io

ForPlugin TypeTransport Type
Socket.ioMethod pluginSocket.io

Unavailable (planned)

Capacitor HTTP

ForPlugin TypeTransport Type
Capacitor HTTPMethod pluginHTTP

Unavailable (planned)

Prim+RPC: a project by Ted Klingenberg

Dose of Ted

Anonymous analytics collected with Ackee