# WEBrick detect http client disconnect

**URL:** <https://rubytalk.org/t/webrick-detect-http-client-disconnect/49934>\
**Category:** ruby-talk\
**Created:** [31 October 2008 19:29 UTC](https://rubytalk.org/t/webrick-detect-http-client-disconnect/49934 "2008-10-31T19:29:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![topgun300](https://avatars.discourse-cdn.com/v4/letter/t/43a26b/32.png) [@topgun300](https://rubytalk.org/u/topgun300)\
**Post date:** [31 October 2008 19:29 UTC](https://rubytalk.org/t/webrick-detect-http-client-disconnect/49934/1 "2008-10-31T19:29:00Z")

</div>

Hello all:

I'm working on a REST-like web service using WEBrick servlets  
(HTTPServer and AbstractServet).

Does anybody know how the HTTPServer could detect when a client closes  
their http session with the server. I would like for the web-server  
to "clean up" data associated with the client automatically in the  
event of a disconnect.

I've tried several methods already (GenericServer#{config,listeners,  
et al} ) to no avail.

Thanks for your time,  
Dave

---

<div class="post-metadata">

**Author:** ![Eric\_Hodel1](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Eric\_Hodel1](https://rubytalk.org/u/Eric_Hodel1)\
**Post date:** [31 October 2008 22:04 UTC](https://rubytalk.org/t/webrick-detect-http-client-disconnect/49934/2 "2008-10-31T22:04:34Z")

</div>

Aren't HTTP connections are supposed to be stateless?

> **···**
>
> On Oct 31, 2008, at 12:29 PM, topgun300 wrote:
> 
> > I'm working on a REST-like web service using WEBrick servlets  
> > (HTTPServer and AbstractServet).
> > 
> > Does anybody know how the HTTPServer could detect when a client closes  
> > their http session with the server. I would like for the web-server  
> > to "clean up" data associated with the client automatically in the  
> > event of a disconnect.
