public override Task OnDisconnected(bool stopCalled) { string key = Context.QueryString["Key"]; string connectionId = Context.ConnectionId; if (string.IsNullOrEmpty(key)) { return(base.OnDisconnected(stopCalled)); } ServerConnectionMap.Remove(key, connectionId); return(base.OnDisconnected(stopCalled)); }
public override Task OnConnected() { string key = Context.QueryString["Key"]; string connectionId = Context.ConnectionId; BroadcastConnectionMap(); if (string.IsNullOrEmpty(key)) { return(base.OnConnected()); } ServerConnectionMap.Add(key, connectionId); return(base.OnConnected()); }
public override Task OnReconnected() { string key = Context.QueryString["Key"]; string connectionId = Context.ConnectionId; if (string.IsNullOrEmpty(key)) { return(base.OnReconnected()); } if (!ServerConnectionMap.GetConnections(key).Contains(connectionId)) { ServerConnectionMap.Add(key, connectionId); } return(base.OnReconnected()); }