IXWebSocketServer Timeout Problems....
How would you implement a callback into the IXWebSocketServer for timeouts?
Because i need to deallocate memory when a client timeouts / disconnects. But the problem is i never get like a disconnect message or error message when a client timeouts in the client message callback!
Am i doing something wrong?
So i have looked further into this. If you force close the application it (the client), the server will not get like a error nor a close message and also the ConnectionState does not deallocate!!
But if you have a Web Browser (ex.: FireFox, Chrome etc.) and you call the .close method it will throw a Close Message in the server handler.
so with repeating printf debugging i narrowed down the problem to .poll, well seems logical.
I mean WebSocketTransport::poll()
so with more printf debugging i narrowed down the problem to Socket::isReadyToRead
So i have tested it more and the problem only occurs in window machines. So i would guess its a winsocks problem. Yay Windows
There was a patch which is windows only a while ago, it seemed to improve things but you could try to revert it, or use the version right before. However there has always been one problem on windows, which is why some unittest are disabled. (check in the cmakelist.txt for the tests, you could try to un-comment them). However you seem to already have a repro case.
@PatchByte did you found a solution?
or @bsergean is there a solution?
there were a few related commits recently, for windows, you might want to try again with latest master
For anyone who is stumbling on this:
- Make a Ping Pong System with a timeout
- If a certain amount of time has passed without a ping then just disconnect the client
(This is a temporary fix, until IXWebSocket fixes this issue, I have no clue what is causing this, but it seems to be an implementation problem with WinSocks as far as I could guess)