I'm trying to use Webbit as a server for an application that will work a little bit like Twitter's firehose, e.g. an endless stream of data. The client sends a request and gets a chunked response of data that never ends. Kind of like an EventSource, but for server-to-server. The problem I'm having is figuring out how to discover when the client closes the connection.
I can see errors being printed about the connection being closed, and even if I can register to handle uncaught errors and connection errors, neither of those hooks seem to have enough information to discover which request/connection was closed.
Even HttpResponse#write throws no exception so my application just keeps on writing data.
For EventSource and for WebSocket handlers there's an explicit hook for closed connections, but not for HTTP, so how can I do it? I just need something that tells me when the connection closes, and gives me enough information to look up the structures I set up when I receive the request in my handler (so I need to get hold of the the request or the response, basically).