public override Task OnDisconnected(bool stopCalled) { string name = Context.User.Identity.Name; string userId = ApplicationUserExtension.GetUserId(name); _connections.Remove(userId, Context.ConnectionId); return(base.OnDisconnected(stopCalled)); }
public override Task OnConnected() { string name = Context.User.Identity.Name; string userId = ApplicationUserExtension.GetUserId(name); _connections.Add(userId, Context.ConnectionId); return(base.OnConnected()); }
public override Task OnReconnected() { string name = Context.User.Identity.Name; string userId = ApplicationUserExtension.GetUserId(name); if (!_connections.GetConnections(userId).Contains(Context.ConnectionId)) { _connections.Add(userId, Context.ConnectionId); } return(base.OnReconnected()); }