Beispiel #1
0
        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());
        }
Beispiel #2
0
        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());
        }