Description
Description:
The UserRealtimeUpdates function currently uses wsHub.BroadcastToAll(buf.Bytes()). This sends HTML updates via WebSocket to every connected client, regardless of whether the update is relevant to them or the page they are currently viewing.
Expected Behavior:
WebSocket broadcasts should be targeted only to the clients for whom the update is relevant. For example, an update related to a specific user or data visible on a particular page should only be sent to clients viewing that page or related to that user.
Action:
Refactor the WebSocket broadcasting logic to implement targeted messaging. This might involve managing subscriptions based on user ID, page context, or other relevant criteria, and using a more specific broadcast method than BroadcastToAll.
Benefit:
Reduces unnecessary network traffic, improves client-side performance (less processing of irrelevant updates), and ensures data is only pushed to relevant contexts.