I'm working on my SignalR Hub.
I want to add Context.ConnectionId to specific group when OnConnectedAsync() was triggered.
When I write something like this:
public override Task OnConnectedAsync()
{
// succeeded adding ConnectionId to User in my cache
if (succeeded)
{
await Groups.AddToGroupAsync(Context.ConnectionId, user.Id1);
await Groups.AddToGroupAsync(Context.ConnectionId, user.Id2);
}
}
I lost all my connections on the hub. When I deleted this AddToGroupAsync() part, everything works fine (connections exist but not in groups).
Why is it that when I'm adding ConnectionId using AddToGroupAsync(), I lose all connections in that simple method?