The client unilaterally terminates the connection either by sending a finish message to the server, or by waiting for the server to time out. Otherwise, if you terminate it unilaterally, the server will not be able to wait and waste resources. .
RequestHandler.on_connection_close()
Called in async handlers if the client closed the connection.
Override this to clean up resources associated with long-lived connections. Note that this method is called only if the connection was closed during asynchronous processing; if you need to do cleanup after every request override on_finish instead.
Proxies may keep a connection open for a time (perhaps indefinitely) after the client has gone away, so this method may not be called promptly after the end user closes their connection.
Override self.on_finish()
Documentation
The client unilaterally terminates the connection either by sending a finish message to the server, or by waiting for the server to time out. Otherwise, if you terminate it unilaterally, the server will not be able to wait and waste resources. .
http://www.tornadoweb.org/en/stable/web....