do-session
SockaDoSession and SockaWebSocketDO on Cloudflare Durable Objects—contract, handlers, wireFormat, SockaError; extends websocket-do BaseSession.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
SockaDoSession and SockaWebSocketDO on Cloudflare Durable Objects—contract, handlers, wireFormat, SockaError; extends websocket-do BaseSession.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Standard Schema socka contracts (defineSocka), v1 wire envelopes, SockaSession/SockaWebSocketClient, React useSockaSession and SockaSessionProvider, SockaError.
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 | do-session |
| description | SockaDoSession and SockaWebSocketDO on Cloudflare Durable Objects—contract, handlers, wireFormat, SockaError; extends websocket-do BaseSession. |
SockaDoSession (@firtoz/socka/do): extends BaseSession from @firtoz/websocket-do. Incoming messages are decoded with decodeSockaWire after JSON parse (text) or parseWirePayload (msgpack). Valid clientRequest frames are dispatched to handlers (typed InferSockaHandlers<typeof contract>). Calls with output get encodeServerResponse on success; calls without output send encodeServerError only on failure; optional encodeServerEvent for contract pushes.SockaWebSocketDO: extend with protected readonly contract, buildSockaSessionConfig(ctx) (constructor only when you need extra setup, e.g. DB migrate). Default session wiring is built-in; use SockaWebSocketDOBase only for a custom SockaDoSession subclass.SockaDoSessionConfig)contract: from defineSocka.wireFormat: "json" (default) or "msgpack"—must match the browser SockaWebSocketClient/SockaSession wireFormat.createData: optional when session TData is empty (Record<string, never>); defaults to {}. Otherwise Hono Context → per-connection state.handlers: call name → async/sync handler; inputs and optional outputs validated with Standard Schema via parseStandardSchema (omit output in the contract for fire-and-forget success; handler still runs on the server).handleClose: cleanup when the socket closes.onHandlerError, onValidationError: optional hooks (validation and handler failures are also mapped to serverError frames).serializeJson, deserializeJson: optional; default JSON.stringify/JSON.parse for JSON mode.SockaError from handlers for domain failures; the session maps the message to a serverError frame so the client can instanceof SockaError when using SockaSession.defineSocka contract on the client: useSockaSession, SockaSessionProvider, or SockaSession with matching wireFormat.@firtoz/websocket-do. Socka adds schema validation and socka v1 framing at the session boundary. Do not re-export websocket-do symbols from socka—import BaseWebSocketDO / BaseSession from @firtoz/websocket-do when you need them.