src/WSclient.cpp
void WebSocketsClient::clientDisconnect(WSclient_t * client) {

    bool event = false;

#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
    if(client->isSSL && client->ssl) {
        if(client->ssl->connected()) {
            client->ssl->flush();
            client->ssl->stop();
        }
        event = true;
        delete client->ssl;
        client->ssl = NULL;
        client->tcp = NULL;
    }
#endif

    if(client->tcp) {
        if(client->tcp->connected()) {
#if (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)
            client->tcp->flush();
#endif
            client->tcp->stop();
        }
        event = true;
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
        client->status = WSC_NOT_CONNECTED;
#else
        delete client->tcp;
#endif
        client->tcp = NULL;
    }

    client->cCode = 0;
    client->cKey = "";
    client->cAccept = "";
    client->cVersion = 0;
    client->cIsUpgrade = false;
    client->cIsWebsocket = false;
    client->cSessionId = "";

    client->status = WSC_NOT_CONNECTED;

    DEBUG_WEBSOCKETS("[WS-Client] client disconnected.\n");
    if(event) {
        runCbEvent(WStype_DISCONNECTED, NULL, 0);
    }
}
/**
 * Disconnect an client
 * @param client WSclient_t *  ptr to the client struct
 */
Disconnect an client
@param client WSclient_t *  ptr to the client struct
Disconnect an client @param client WSclient_t * ptr to the client struct
void WebSocketsClient::clientDisconnect(WSclient_t * client) {
    bool event = false;
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266) || (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32)
    if(client->isSSL && client->ssl) {
        if(client->ssl->connected()) {
            client->ssl->flush();
            client->ssl->stop();
        }
        event = true;
        delete client->ssl;
        client->ssl = NULL;
        client->tcp = NULL;
    }
#endif
    if(client->tcp) {
        if(client->tcp->connected()) {
#if (WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC)
            client->tcp->flush();
#endif
            client->tcp->stop();
        }
        event = true;
#if (WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC)
        client->status = WSC_NOT_CONNECTED;
#else
        delete client->tcp;
#endif
        client->tcp = NULL;
    }
    client->cCode = 0;
    client->cKey = "";
    client->cAccept = "";
    client->cVersion = 0;
    client->cIsUpgrade = false;
    client->cIsWebsocket = false;
    client->cSessionId = "";
    client->status = WSC_NOT_CONNECTED;
    DEBUG_WEBSOCKETS("[WS-Client] client disconnected.\n");
    if(event) {
        runCbEvent(WStype_DISCONNECTED, NULL, 0);
    }
}
void WebSocketsClient :: clientDisconnect ( WSclient_t * client ) { bool event = false ; #if ( WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266 ) || ( WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP32 ) if ( client -> isSSL && client -> ssl ) { if ( client -> ssl -> connected ( ) ) { client -> ssl -> flush ( ) ; client -> ssl -> stop ( ) ; } event = true ; delete client -> ssl ; client -> ssl = NULL ; client -> tcp = NULL ; } #endif if ( client -> tcp ) { if ( client -> tcp -> connected ( ) ) { #if ( WEBSOCKETS_NETWORK_TYPE != NETWORK_ESP8266_ASYNC ) client -> tcp -> flush ( ) ; #endif client -> tcp -> stop ( ) ; } event = true ; #if ( WEBSOCKETS_NETWORK_TYPE == NETWORK_ESP8266_ASYNC ) client -> status = WSC_NOT_CONNECTED ; #else delete client -> tcp ; #endif client -> tcp = NULL ; } client -> cCode = 0 ; client -> cKey = " " ; client -> cAccept = " " ; client -> cVersion = 0 ; client -> cIsUpgrade = false ; client -> cIsWebsocket = false ; client -> cSessionId = " " ; client -> status = WSC_NOT_CONNECTED ; DEBUG_WEBSOCKETS ( " \n " ) ; if ( event ) { runCbEvent ( WStype_DISCONNECTED , NULL , 0 ) ; } }
Disconnect an client
 @param client WSclient_t *  ptr to the client struct
Disconnect an client @param client WSclient_t * ptr to the client struct