Skip to main content

Function: handleRpcRequest()

handleRpcRequest(request, doInstance, config?): Promise<Response | undefined>

Defined in: lumenize-rpc-do.ts:108

Handle RPC requests manually without using the factory function.

Only use this if you want more direct control over the routing inside your DO. Most of the time, you will use the auto-wrapper functionality of lumenizeRpcDO.

Returns Response for RPC requests, undefined for non-RPC requests.

This function is called from the fetch handler to check if an incoming message is an RPC request and handle it accordingly.

Parameters​

request​

Request

The incoming HTTP request

doInstance​

any

The Durable Object instance to operate on

config?​

RpcConfig = {}

Optional RPC configuration

Returns​

Promise<Response | undefined>

Response for RPC requests, undefined for non-RPC requests

See​

For working examples, see packages/rpc/test/test-worker-and-dos.ts