You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current WebSocket setup is limited to chat components, preventing real-time functionality across the application. Additionally, the existing hub lacks flexible broadcasting and per-connection context handling.
Objectives
1. Global WebSocket Integration
Move ws-connect in HTMX as close to <body> as possible to initialize WebSocket early and enable it app-wide.
2. Global WebSocket Hub
Refactor the WebSocket hub into a globally accessible component for all parts of the application.
3. Channel-Based Subscriptions
Implement dynamic channel support in the hub:
Connections can subscribe to multiple channels simultaneously.
Channels should be flexible and arbitrary, not limited to pre-defined types.
4. Per-Connection Context
Each connection should hold contextual data (e.g., User info, Session details) in-memory.
Context should be available when broadcasting.
Broadcasting API – Required Methods
Method
Description
BroadcastToUser(userID string, message)
Send a message to a single user.
BroadcastToChannel(channel string, message)
Send a message to all connections in a specific channel.
Problem
The current WebSocket setup is limited to chat components, preventing real-time functionality across the application. Additionally, the existing hub lacks flexible broadcasting and per-connection context handling.
Objectives
1. Global WebSocket Integration
ws-connect
in HTMX as close to<body>
as possible to initialize WebSocket early and enable it app-wide.2. Global WebSocket Hub
3. Channel-Based Subscriptions
4. Per-Connection Context
Broadcasting API – Required Methods
BroadcastToUser(userID string, message)
BroadcastToChannel(channel string, message)
BroadcastToAll(message)
Connection & Channel Management – Required Methods
The hub should provide access to active connections:
GetConnectionsInChannel(channel string)
GetAllConnections()
Each connection object should expose:
UserID
,SessionID
)[]string
)Expected Outcome
company/29
).Suggested Implementation Plan
ws-connect
(HTMX) near<body>
.Additional Considerations
The text was updated successfully, but these errors were encountered: