Interface: RpcClientConfig
Defined in: packages/rpc/src/types.ts:138
Configuration options for creating an RPC client. These are the optional parameters passed to createRpcClient().
Example
const client = createRpcClient<MyDO>('MY_DO', 'instance-name', {
transport: 'websocket',
baseUrl: 'https://api.example.com',
headers: { 'Authorization': 'Bearer token' }
});
Properties
baseUrl?
optional
baseUrl:string
Defined in: packages/rpc/src/types.ts:149
Base URL for the RPC endpoints
Default
location.origin (browser) or 'http://localhost:8787' (Node)
fetch()?
optional
fetch: {(input
,init?
):Promise
<Response
>; (input
,init?
):Promise
<Response
>; (input
,init?
):Promise
<Response
>; }
Defined in: packages/rpc/src/types.ts:167
Alternative fetch function (e.g. SELF.fetch.bind(SELF)
for in vitest Workers pool env)
Call Signature
(
input
,init?
):Promise
<Response
>
Parameters
input
URL
| RequestInfo
init?
RequestInit
<CfProperties
<unknown
>>
Returns
Promise
<Response
>
Call Signature
(
input
,init?
):Promise
<Response
>
Parameters
input
URL
| RequestInfo
init?
RequestInit
<RequestInitCfProperties
>
Returns
Promise
<Response
>
Call Signature
(
input
,init?
):Promise
<Response
>
Parameters
input
string
| URL
| Request
<unknown
, CfProperties
<unknown
>>
init?
RequestInit
<CfProperties
<unknown
>>
Returns
Promise
<Response
>
Default
globalThis.fetch
headers?
optional
headers:Record
<string
,string
>
Defined in: packages/rpc/src/types.ts:173
Request headers to include in all HTTP RPC requests
Default
{}
prefix?
optional
prefix:string
Defined in: packages/rpc/src/types.ts:155
RPC endpoint prefix (must match server-side RpcConfig.prefix)
Default
'/__rpc'
timeout?
optional
timeout:number
Defined in: packages/rpc/src/types.ts:161
Request timeout in milliseconds
Default
30000
transport?
optional
transport:"websocket"
|"http"
Defined in: packages/rpc/src/types.ts:143
Transport type to use for RPC communication
Default
'websocket'
WebSocketClass()?
optional
WebSocketClass: (url
,protocols?
) =>WebSocket
Defined in: packages/rpc/src/types.ts:179
WebSocket class. Use the WebSocket that's returned from getWebSocketShim(...)
in vitest Workers pool env
Parameters
url
string
protocols?
string
| string
[]
Returns
WebSocket
Default
globalThis.WebSocket