SignalR & Real-Time .NET Applications

Managing Connection IDs and User Identifiers

1 Views Updated 5/4/2026

Tracking Individuals

Understanding the difference between a Connection ID and a User ID is vital for building multi-device apps.

1. The Connection ID

Every time a browser tab opens, it gets a unique, temporary ConnectionId. If the user refreshes, they get a new one. Targeting a specific Connection ID is rare; it's mostly used for responding only to the 'Current Caller'.

2. The User ID

A UserId represents the human (or service). One user might have three tabs open, a phone app, and a tablet—all connected. When you call Clients.User(userId).SendAsync(...), SignalR is smart enough to find ALL active connections for that user across all their devices and push the message to all of them.

3. Architect Insight

Q: "How does SignalR know the User ID?"

Architect Answer: "By default, it uses the ClaimTypes.NameIdentifier from the user's claims. If you want to use a different claim (like 'Email' or a custom 'MemberID'), you must implement a custom IUserIdProvider. This is common in enterprise systems that use legacy IDs."

SignalR & Real-Time .NET Applications
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