RPC Docs.
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).
For | Plugin Type | Transport Type |
---|---|---|
Fetch API | Method plugin | HTTP |
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.
For | Plugin Type | Transport Type |
---|---|---|
WebSocket API | Callback plugin | WebSocket |
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.
For | Plugin Type | Transport Type |
---|---|---|
Axios | Method plugin | HTTP |
Unavailable (planned)
For | Plugin Type | Transport Type |
---|---|---|
Socket.io | Method plugin | Socket.io |
Unavailable (planned)
For | Plugin Type | Transport Type |
---|---|---|
Capacitor HTTP | Method plugin | HTTP |
Unavailable (planned)