Skip to content

onRpc

onRpc<TReq, TRes>(contract, handler, options?): RpcHandlerDeclaration

Defined in: packages/hoppity/src/handlers/onRpc.ts:15

Declares a typed RPC handler for use in the service config handlers array.

Both the request and response types are inferred from the contract’s schemas. The handler must return a Promise resolving to the response schema’s inferred type.

TReq extends ZodTypeAny

TRes extends ZodTypeAny

RpcContract<any, any, TReq, TRes>

The RpcContract to handle

RpcHandler<TReq, TRes>

The handler function

HandlerOptions

Optional queue/redelivery/dead-letter overrides

RpcHandlerDeclaration