m_NumPings needs reset on termination, otherwise any time ping causes disconnect, when you reconnect, the first ping will cause it to disconnect again.
void WebSocket::terminate() {
//m_Client.flush();
m_Client.stop();
m_eReadyState = WSRS_CLOSED;
m_NumPings = 0; // add this here
}
m_NumPings needs reset on termination, otherwise any time ping causes disconnect, when you reconnect, the first ping will cause it to disconnect again.