1"use strict";(globalThis.webpackChunk_lumenize_website=globalThis.webpackChunk_lumenize_website||[]).push([[428],{92998(e,n,s){s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>u,frontMatter:()=>r,metadata:()=>c,toc:()=>l});const c=JSON.parse('{"id":"rpc/api/functions/handleRpcRequest","title":"Function: handleRpcRequest()","description":"handleRpcRequest(request, doInstance, config?): Promise\\\\","source":"@site/docs/rpc/api/functions/handleRpcRequest.md","sourceDirName":"rpc/api/functions","slug":"/rpc/api/functions/handleRpcRequest","permalink":"/docs/rpc/api/functions/handleRpcRequest","draft":false,"unlisted":false,"editUrl":"https://github.com/lumenize/lumenize/tree/main/website/docs/rpc/api/functions/handleRpcRequest.md","tags":[],"version":"current","frontMatter":{},"sidebar":"docsSidebar","previous":{"title":"handleRpcMessage","permalink":"/docs/rpc/api/functions/handleRpcMessage"},"next":{"title":"lumenizeRpcDO","permalink":"/docs/rpc/api/functions/lumenizeRpcDO"}}');var i=s(62540),t=s(43023);const r={},o="Function: handleRpcRequest()",d={},l=[{value:"Parameters",id:"parameters",level:2},{value:"request",id:"request",level:3},{value:"doInstance",id:"doinstance",level:3},{value:"config?",id:"config",level:3},{value:"Returns",id:"returns",level:2},{value:"See",id:"see",level:2}];function a(e){const n={a:"a",blockquote:"blockquote",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",p:"p",strong:"strong",...(0,t.R)(),...e.components};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.header,{children:(0,i.jsx)(n.h1,{id:"function-handlerpcrequest",children:"Function: handleRpcRequest()"})}),"\n",(0,i.jsxs)(n.blockquote,{children:["\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.strong,{children:"handleRpcRequest"}),"(",(0,i.jsx)(n.code,{children:"request"}),", ",(0,i.jsx)(n.code,{children:"doInstance"}),", ",(0,i.jsx)(n.code,{children:"config?"}),"): ",(0,i.jsx)(n.code,{children:"Promise"}),"<",(0,i.jsx)(n.code,{children:"Response"})," | ",(0,i.jsx)(n.code,{children:"undefined"}),">"]}),"\n"]}),"\n",(0,i.jsxs)(n.p,{children:["Defined in: ",(0,i.jsx)(n.a,{href:"https://github.com/lumenize/lumenize/blob/c0ab9033efcaa9e8b6e373f98351d09c540fce16/packages/rpc/src/lumenize-rpc-do.ts#L108",children:"lumenize-rpc-do.ts:108"})]}),"\n",(0,i.jsx)(n.p,{children:"Handle RPC requests manually without using the factory function."}),"\n",(0,i.jsxs)(n.p,{children:["Only use this if you want more direct control over the routing inside your DO.\nMost of the time, you will use the auto-wrapper functionality of ",(0,i.jsx)(n.code,{children:"lumenizeRpcDO"}),"."]}),"\n",(0,i.jsx)(n.p,{children:"Returns Response for RPC requests, undefined for non-RPC requests."}),"\n",(0,i.jsx)(n.p,{children:"This function is called from the fetch handler to check if\nan incoming message is an RPC request and handle it accordingly."}),"\n",(0,i.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,i.jsx)(n.h3,{id:"request",children:"request"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.code,{children:"Request"})}),"\n",(0,i.jsx)(n.p,{children:"The incoming HTTP request"}),"\n",(0,i.jsx)(n.h3,{id:"doinstance",children:"doInstance"}),"\n",(0,i.jsx)(n.p,{children:(0,i.jsx)(n.code,{children:"any"})}),"\n",(0,i.jsx)(n.p,{children:"The Durable Object instance to operate on"}),"\n",(0,i.jsx)(n.h3,{id:"config",children:"config?"}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.a,{href:"/docs/rpc/api/interfaces/RpcConfig",children:(0,i.jsx)(n.code,{children:"RpcConfig"})})," = ",(0,i.jsx)(n.code,{children:"{}"})]}),"\n",(0,i.jsx)(n.p,{children:"Optional RPC configuration"}),"\n",(0,i.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,i.jsxs)(n.p,{children:[(0,i.jsx)(n.code,{children:"Promise"}),"<",(0,i.jsx)(n.code,{children:"Response"})," | ",(0,i.jsx)(n.code,{children:"undefined"}),">"]}),"\n",(0,i.jsx)(n.p,{children:"Response for RPC requests, undefined for non-RPC requests"}),"\n",(0,i.jsx)(n.h2,{id:"see",children:"See"}),"\n",(0,i.jsx)(n.p,{children:"For working examples, see packages/rpc/test/test-worker-and-dos.ts"})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,i.jsx)(n,{...e,children:(0,i.jsx)(a,{...e})}):a(e)}},43023(e,n,s){s.d(n,{R:()=>r,x:()=>o});var c=s(63696);const i={},t=c.createContext(i);function r(e){const n=c.useContext(t);return c.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(i):e.components||i:r(e.components),c.createElement(t.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.