Tutorials SignalR & Real-Time .NET Applications
Managing Connection IDs and User Identifiers
On this page
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."