Sign in to track progress and bookmarks.
Understanding the difference between a Connection ID and a User ID is vital for building multi-device apps.
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'.
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.
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."
Quizzes linked to this course—pass to earn certificates.
On this page
1. The Connection ID 2. The User ID 3. Architect Insight