Description
I think we have a racing condition here. Sometimes request to connect to custom namespace (40/nsp) is not sent.
We debugged it to the method flushProbeWait()
in SocketEngine
.
It is called on web socket connect success in doFastUpgrade()
and on web socket connect failure in websocketDidDisconnect(error: Error?)
(in case we are polling which is always true on start). Inside this method we have this code:
if postWait.count != 0 {
flushWaitingForPostToWebSocket()
}
Method flushWaitingForPostToWebSocket()
causes packets to be sent by web socket. And it fails if web socket failed to connect. In our case we lose request to connect to custom namespace and do not get connected at all.
I think it will be better to move this "if" from flushProbeWait()
directly to doFastUpgrade()
, so it will be called only on web socket connect success.