Notification when HTTP connection is closed by the caller

45 views
Skip to first unread message

Theo

unread,
Aug 21, 2013, 2:44:04 PM8/21/13
to web...@googlegroups.com
Hi,

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).

yours,
Theo

peter hausel

unread,
Aug 22, 2013, 2:46:00 PM8/22/13
to web...@googlegroups.com
you might want to take a look at this PR:

Theo

unread,
Aug 25, 2013, 1:45:32 PM8/25/13
to web...@googlegroups.com
thanks, looks like what I need.

T#
Reply all
Reply to author
Forward
0 new messages