Reputation: 1958
I have an nginx-server with one-hour timeout and a Tornado web-server behind it.
When nginx closes the connection, I have no idea about it in Tornado. I saw this question about closing connections automatically by timeout-event (Implementing and testing WebSocket server connection timeout) and I'm going to use it as a fallback workaround.
My question is: does the Tornado have an internal mechanism for websocket connections invalidation?
Upvotes: 3
Views: 1002
Reputation: 22134
WebSocketHandler
has an overridable on_close
method, which should be getting called when the connection is closed (most of the time). This method is not 100% reliable (due to the limitations of the underlying network protocols), however, so a timeout-based fallback is recommended. Tornado doesn't have any built-in support for this, though, so you'll have to implement it yourself, perhaps in a manner similar to the answer you linked to.
Upvotes: 1