SignalR & Real-Time .NET Applications
Lesson 2 of 16 13% of course

SignalR Hub Anatomy: Methods, Callbacks, and Protocols

15 · 8 min · 5/23/2026

Sign in to track progress and bookmarks.

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

Test your knowledge

Quizzes linked to this course—pass to earn certificates.

Browse all quizzes
SignalR & Real-Time .NET Applications

On this page

1. Hub Methods 2. Context and Groups 3. Architect Insight
1. SignalR Core
Real-time Theory: WebSockets vs Long Polling vs Server-Sent Events SignalR Hub Anatomy: Methods, Callbacks, and Protocols Configuring the Connection: Transports and Retries Strongly Typed Hubs: Enforcing the contract
2. Managing Users & Groups
Authentication & Authorization in SignalR Managing Connection IDs and User Identifiers Group Management: Designing Rooms and Channels Presence Tracking: Who is online?
3. Scaling SignalR
The Stateless Problem: Sticky sessions and Load Balancers Redis Backplane: Syncing multiple servers Azure SignalR Service: Offloading the connection load Monitoring Connection Health with Hub Metrics
4. Advanced Communication
Server-to-Client Streaming: Sending large data chunks Client-to-Server Streaming: Uploading in real-time Binary Protocols: Using MessagePack for extreme speed Handling Large Payload strategies