Hi,
I'm using Vert.x to power a chat server that's used for the chat functionality of a mobile app. It uses WebSockets and is behind an NGINX proxy.
I was using Vertx 3.8.4 and I'm in the process of upgrading to the latest version. Version 3.9.3 is causing problems with my detection of lost connection and the closing of them.
Basically, my WebSocket has a close handler in which I do some cleanup stuff (mark the user as not connection in the DB, etc...). I have a ping-pong process for detecting stale connections: a ping is written to the WebSocket on a timer and if the pong is not received on the next timer invocation, I close the WebSocket.
Before 3.9.3, the close handler was called pretty much directly after the WebSocket close. With 3.9.3, it can take up to 15 minutes. I guess it's because of
WebSocket closing handshake improvements #3531. Since the server now seem to wait for some acknowledgment frame to close the TCP connection after sending the close frame, this will never come if the connection to the client is broken. Maybe if the client was connection directly to Vert.x it could detect the broken connection, but in my case I guess Vert.x connection to NGINX is still good even if the connection from NGINX to the client is broken.
I know this could be considered a problem with my setup (NGINX), but let's say a client is buggy or malicious, it could simply not respond to the close frame and keep the connection open for a long time and on the server I would have no way to close it. Would it be possible for the TCP connection to be really closed after a ws.close(), whether by passing a max amount of time to wait or some other method?
Thanks
Eric