示例#1
0
        /// <summary>
        /// Removes client from the channel
        /// </summary>
        public async Task <bool> RemoveClient(MqClient client)
        {
            ChannelClient cc = _clients.FindAndRemove(x => x.Client == client);

            if (cc == null)
            {
                return(false);
            }

            client.Leave(cc);

            if (EventHandler != null)
            {
                await EventHandler.OnClientLeft(cc);
            }

            if (Options.DestroyWhenEmpty && _clients.Count == 0)
            {
                await CheckAutoDestroy();
            }

            return(true);
        }