Tutorials SignalR & Real-Time .NET Applications

SignalR Hub Anatomy: Methods, Callbacks, and Protocols

On this page

Inside the Hub

A Hub is the central high-level pipeline that bridges your C# server logic with your client-side Javascript or .NET clients.

1. Hub Methods

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.

2. Context and Groups

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.

3. Architect Insight

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."

Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

SignalR & Real-Time .NET Applications
Course syllabus
1. SignalR Core
2. Managing Users & Groups
3. Scaling SignalR
4. Advanced Communication
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details