core-rpc
Standard Schema socka contracts (defineSocka), v1 wire envelopes, SockaSession/SockaWebSocketClient, React useSockaSession and SockaSessionProvider, SockaError.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Standard Schema socka contracts (defineSocka), v1 wire envelopes, SockaSession/SockaWebSocketClient, React useSockaSession and SockaSessionProvider, SockaError.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
SockaDoSession and SockaWebSocketDO on Cloudflare Durable Objects—contract, handlers, wireFormat, SockaError; extends websocket-do BaseSession.
Standard Schema v1 for socka contracts and wire validation—Zod, Valibot, or any compatible library; no Zod-only public surface.
Enforce strict TypeScript typing without escape hatches. Never use `any`, `as` casts to bypass the compiler, or similar workarounds—find the proper typed solution instead.
React Router v7 routing patterns and environment variable configuration. Use when adding routes, configuring routing, or setting up environment variables.
Read when implementing multi-phase work after a plan exists. Mandatory—mkdir+touch then Write/StrReplace (no heredocs), update the temp punch list at every phase boundary, one item at a time, per-phase tests. Complements punch-list-planning for authors.
Read when authoring implementation plans, phased roadmaps, or CreatePlan output for multi-step code work. Ensures the plan hands off a mandatory temp punch list and tells the executor which skill to follow.
| name | core-rpc |
| description | Standard Schema socka contracts (defineSocka), v1 wire envelopes, SockaSession/SockaWebSocketClient, React useSockaSession and SockaSessionProvider, SockaError. |
defineSocka in @firtoz/socka/core: pass calls (and optional pushes) with StandardSchemaV1 input and optional output per call. Omit output for fire-and-forget (no serverResponse on success; client send resolves after send; failures use serverError + reportError). Use output: z.void() for a correlated ACK. Types flow from InferSockaSend, InferSockaHandlers, InferSockaPushHandlers.defineSockaProtocol / defineSockaRpcSpec in socka—those names belong to other stacks; use defineSocka only.SockaWebSocketClient / SockaSession in @firtoz/socka/client: constructed with contract, url or webSocket, optional wireFormat: "json" (default, text frames) or "msgpack" (binary ArrayBuffer—must match the server). Optional pushHandlers for server serverEvent frames (typed from the contract). On SockaSession, call contract methods as await session.send.echo(...) (same shape as useSockaSession’s send); use session.subscribe for push subscriptions.SockaError: thrown on correlated RPC failures when using SockaSession (check instanceof SockaError).useSockaSession(contract, options, deps) in @firtoz/socka/react: returns { ready, send, sessionRef }. send exposes typed call methods (e.g. send.list()). Pass pushHandlers in options for contract pushes (not a separate “server push” table).useSocka(options, deps): lower level; sessionRef to SockaSession if you build send yourself.SockaSessionProvider (same props as useSockaSession plus children), then call useSockaSessionContext(contract) in descendants. Pass the same contract reference as the provider; the hook checks reference equality.decodeSockaWire (socka, v, discriminators, id, rpc, body, …). Invalid payloads become SockaWireError (or onValidationError on the client).serverResponse (unless the call omits output, then no success frame); RPC failure → serverError (optional rpc field for procedure name); server pushes → serverEvent with event name + body.wireFormat.SockaDoSession / SockaWebSocketDO in @firtoz/socka/do—see @firtoz/socka/do-session skill. Human-oriented wiring for React + DO: React + Durable Objects; canvas / whiteboard contract sketch: Collaborative realtime.@firtoz/socka/core helpers (encodeClientRequest, decodeSockaWire, encodeSockaWire, parseWirePayload) only if you bypass SockaSession / SockaDoSession.