A Hub is the central high-level pipeline that bridges your C# server logic with your client-side Javascript or .NET clients.
Public methods in your Hub class can be called directly by the client. await Clients.All.SendAsync("ReceiveMessage", message); pushes data to everyone. You can also target specific users, groups, or even specific connection IDs.
Inside a Hub method, you have access to the Context, which contains the current user's identity and connection ID. You can add users to **Groups** (like 'RoomA') to create multi-user chat rooms or collaborative areas without managing connection IDs manually.
Q: "Should I do heavy processing inside a Hub?"
Architect Answer: "NO. Hubs are for communication. If you need to perform a heavy calculation or a database write, do it in a background service (using IHubContext to push updates when done). Keeping Hub methods fast ensures your WebSocket connection remains stable and responsive."