Beispiel #1
0
        // To disconnect
        private void UpdateStateUsers(Guid connectionId)
        {
            ConnectedUsers user = currentUsers
                                  .Where(p => p.UserConnecionId == connectionId)
                                  .FirstOrDefault();

            if (user != null)
            {
                currentUsers.Remove(user);
            }
        }
Beispiel #2
0
        // to connect
        private void UpdateStateUsers(string name)
        {
            ConnectedUsers user = currentUsers
                                  .Where(p => p.UserName == name)
                                  .FirstOrDefault();

            if (user != null)
            {
                currentUsers.Remove(user);
            }

            currentUsers
            .Add(new ConnectedUsers()
            {
                UserName        = name,
                UserConnecionId = new Guid(Context.ConnectionId)
            });
        }