Unified WebSocket System mit Rooms/Channels #264
Labels
No labels
good first issue
has-pr
help wanted
idea
priority
critical
priority
high
priority
low
priority
medium
status
blocked
status
in-progress
status
needs-review
status
ready
type
bug
type
docs
type
enhancement
type
feature
type
refactor
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
#263 feat: WorkerHub Federation - Verteilte Worker-Pools mit Prioritäten
customable/claude-mem
Reference
customable/claude-mem#264
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
Aktuell haben wir eine Hybrid-Architektur:
/api/stream) für UI-Updates (Server → Client only)/ws) für Worker-Kommunikation (bidirektional)Das führt zu:
Vorschlag: Unified WebSocket mit Rooms/Channels
Ein einziges WebSocket-System für alle Clients (Browser, Worker, Hubs).
Architektur
Client-Typen
Protokoll
1. Connection & Auth
2. Subscription (Browser/Hub)
3. Worker Registration
4. Task Assignment (Worker only)
5. Events (Broadcast)
Channel-Patterns
session:*task:*worker:*observation:*claudemd:*summary:*prompt:*subagent:*Permissions nach Client-Typ
subscribesubscribe,task:receive,task:completesubscribe,broadcast,federateMigration
UI-Integration
Vorteile
Offene Fragen
Abhängigkeiten
Aufwand
Partial Implementation: useWebSocket Hook
Created
packages/ui/src/hooks/useWebSocket.tswith:session:*,task:*)Message Types:
auth,auth:success,auth:failedsubscribe,unsubscribe,subscribedevent(with channel routing)ping,pongCommit:
6ef5efeNext step: Implement backend WebSocket handler with channel routing.
Implementation Complete ✅
Backend:
ChannelManager(packages/backend/src/websocket/channel-manager.ts) - Wildcard pattern matching, subscription managementWorkerHubintegration - subscribe/unsubscribe message handling, channel-based event routingUI:
useWebSockethook (packages/ui/src/hooks/useWebSocket.ts) - Channel subscriptions, auto-reconnect with exponential backoff, global state sharingFeatures implemented:
session:*,task:*,*)Migration Note:
SSE endpoints remain active for backward compatibility. UI components can use either
useSSE(legacy) oruseWebSocket(new). Full SSE deprecation can be done in a separate cleanup issue.