WebSockets: a server-side handle to a room, to broadcast to or close its connections from other server code
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 30/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- typescript
研究方向
Start by reading the defineRoom API for *.ws.ts routes and the existing onRequest approach described in the issue; inspect how the generated binding in void.lock.json identifies a room instance. The proposal calls for a supported server-side handle usable from route handlers, auth hooks, queues, and cron jobs. Done means external code can address the same room instance as a client's connect() and use it to broadcast or close selected connections.
由索引模型根據 Issue 內容生成。
描述
Void 1.5.0, Cloudflare target, defineRoom in a *.ws.ts route.
We need to reach a room from server code outside its own hooks. Our case is closing a user's open sockets when their Better Auth session is revoked: databaseHooks.session.delete.after fires on every revoke, sign-out and user deletion, but from there nothing in Void's API reaches the room's Durable Object. The docs only suggest re-checking records in onMessage and closing, which leaves an idle socket of a revoked session open until its next frame, and costs a database read per frame.
The only way we found is undocumented: the binding name Void generates (from void.lock.json), idFromName('<param>=<value>'), and a request handled in onRequest. We do not want to depend on those internals.
Proposal: a server-side handle to a room instance, for example:
import { getRoom } from 'void/ws';
const room = getRoom('/relay/:accountId', { params: { accountId } });
await room.broadcast(event);
await room.close({ code: 4001, reason: 'session revoked', filter: (connection) => connection.state.sessionId === id });
usable from route handlers, auth hooks, queues and cron jobs, and addressing the same instance a client's connect() would.
- 主要語言
- TypeScript
- 星號
- 627
- 分支
- 66
- 平均合併
- 13 小時 57 分鐘
- 30 天內合併 PR
- 194
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
voidzero-dev/void 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 62/100
voidzero-dev/void#677 ·
維護者通常 1 天內回覆
-
Export a guard for `VoidActionError` at every status可能已有人在做 @karthickeyan-dev 今天認領。 未關閉
難度 3/5 1-2 天 新手友好度 78/100
voidzero-dev/void#714 ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 72/100
voidzero-dev/void#713 · 1 則留言 ·
維護者通常 1 天內回覆
-
`@void/solid`: `useParams()` keeps the first page's params after client-side navigation可能已有人在做 @yujiym 今天認領。 未關閉
難度 1/5 1 小時以內 新手友好度 20/100
voidzero-dev/void#708 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 28/100
voidzero-dev/void#692 · 1 則留言 ·
維護者通常 1 天內回覆
查看 voidzero-dev/void 的全部 Issue
相似的 Issue
-
apps/stage-web bug env/os-linux pending triage scope/audio-output
難度 2/5 1-3 小時 新手友好度 82/100
維護者通常 1 天內回覆
-
reproduced
難度 2/5 1-3 小時 新手友好度 68/100
anomalyco/opencode#61640 · 1 則留言 ·
維護者通常 1 天內回覆
-
scope: data grid status: waiting for maintainer
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 2 天內回覆
-
ai-driven-fuzzing bug Minor
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
ai-driven-fuzzing bug claude Minor
難度 2/5 1-3 小時 新手友好度 82/100
linagora/twake-calendar-frontend#1944 ·
維護者通常 1 天內回覆