Replies: 1 comment
-
I'll try to answer the various points: Can a certain UserIdentifier have multiple ConnectionId(s)? Yes, a single UserIdentifier can have multiple ConnectionId(s). This can happen in several scenarios:
Will Clients.User(Context.UserIdentifier).SendAsync() send to all connections with the same UserIdentifier? Yes, when you call Clients.User(userIdentifier).SendAsync(), SignalR will send the message to all connections associated with that UserIdentifier. This is useful when you want to send a message to a user, regardless of which device or browser they are using, or how many connections they currently have. Why have SignalR groups if we can use UserIdentifier? Groups and UserIdentifier serve different purposes, and both are useful in their own contexts:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
My question relates to SignalR. I'm trying to understand the philosophy behind groups and why do we need them. My question is three fold:
IUserIdProvider
or a reconnect event happens in the client)?Clients.User(Context.UserIdentifier).SendAsync()
be sending to all users with the same user UserIdentifier?Clients.User(Context.UserIdentifier).SendAsync()
rather thanClients.Group(groupName).SendAsync()
?The purpose of this discussion is to merely understand the philosophy behind UserIdentifier, ConnectionId and Groups rather than ask about a specific scenario.
Beta Was this translation helpful? Give feedback.
All reactions