Exemplo n.º 1
0
        /// Disconnects a specific client.
        /// If the client wasn't connected already it will return false.
        /// </summary>
        /// <param name="clientIndex"></param>
        ///<param name="withDisconnectPacket"> True = Disconnect packet received from the client. \n False = protocol violation or error has occured</param>
        /// <returns>True if the client has been successfully disconnected , or was disconnected already</returns>
        public void DisconnectClient(uint clientIndex, bool withDisconnectPacket, bool isWebSocketClient)
        {
            MqttClient c = GetClientByIndex(clientIndex, isWebSocketClient);

            if (!c.IsWebSocketClient)
            {
                tcpServer.DisconnectClient(clientIndex, withDisconnectPacket);
            }
            else
            {
                wsServer.DisconnectClient(clientIndex, withDisconnectPacket);
            }
        }