LWS_CALLBACK_EVENT_WAIT_CANCELLED received with no lws_cancel_service called?
I am using libwebsockets to build connection with ws server, and receive data from server (Binance)
after i built connection, I got these event type regularly (every several minutes):
LWS_CALLBACK_GET_THREAD_ID
LWS_CALLBACK_EVENT_WAIT_CANCELLED
LWS_CALLBACK_CLIENT_RECEIVE_PONG
I read the header, for type LWS_CALLBACK_EVENT_WAIT_CANCELLED, it said: it's a callback of lws_cancel_service
but i never call this function. below is my service function:
while (true) {
try {
lws_service(ctx_, 0);
} catch (std::exception &e) {
EE("<CRYPTO_websocket::enter_event_loop> Error ! %s", e.what());
}
}
after some LWS_CALLBACK_EVENT_WAIT_CANCELLED comes, the connection is broken.
so, is there anything i can do to avoid this? to make the connection stable and long? thanks a lot
Since it's based on binance example, it will be using compression... it sounds like a bug with handling PING / PONG inside a compressed link. EVENT_WAIT_CANCELLED is not what it sounds like, "cancelling the wait" is event loop-speak for waking from sleep to handle something (and then go back to the event wait sleep).