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