コード例 #1
0
 public void RemoveClient(GroupWebSocketService client)
 {
     lock (clients)
         clients.Remove(client);
     if (client.groups.Contains(this))
     {
         client.groups.Remove(this);
     }
 }
コード例 #2
0
 public void AddClient(GroupWebSocketService client)
 {
     lock (clients)
         clients.Add(client);
     if (!client.groups.Contains(this))
     {
         client.groups.Add(this);
     }
 }
コード例 #3
0
        /// <summary>
        /// Adds a client to a group
        /// </summary>
        /// <param name="query"></param>
        public WebSocketGroup AddClient(GroupWebSocketService client, WebSocketGroupQuery query)
        {
            //Get a group for this client
            WebSocketGroup g = GetClientGroup(query);

            //Add client to group
            g.AddClient(client);

            return(g);
        }
コード例 #4
0
        public void RemoveClient(GroupWebSocketService client)
        {
            while (client.groups.Count > 0)
            {
                //Get group
                var g = client.groups[0];

                //Remove the client from the group
                g.RemoveClient(client);

                //If this group is empty, remove it
                if (g.GetClientCount() == 0)
                {
                    RemoveGroup(g);
                }
            }
        }