Пример #1
0
        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));
        }
Пример #2
0
        public override Task OnConnected()
        {
            string name   = Context.User.Identity.Name;
            string userId = ApplicationUserExtension.GetUserId(name);

            _connections.Add(userId, Context.ConnectionId);

            return(base.OnConnected());
        }
Пример #3
0
        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());
        }