# WEBrick detect http client disconnect

**URL:** <https://www.ruby-forum.com/t/webrick-detect-http-client-disconnect/152253>\
**Category:** Ruby\
**Created:** [October 31, 2008, 8:30pm UTC](https://www.ruby-forum.com/t/webrick-detect-http-client-disconnect/152253 "2008-10-31T20:30:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![topgun300](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/43a26b/32.png) [@topgun300](https://www.ruby-forum.com/u/topgun300)\
**Post date:** [October 31, 2008, 8:30pm UTC](https://www.ruby-forum.com/t/webrick-detect-http-client-disconnect/152253/1 "2008-10-31T20:30:28Z")

</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:** ![topgun300](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/43a26b/32.png) [@topgun300](https://www.ruby-forum.com/u/topgun300)\
**Post date:** [October 31, 2008, 11:06pm UTC](https://www.ruby-forum.com/t/webrick-detect-http-client-disconnect/152253/2 "2008-10-31T23:06:21Z")

</div>

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.

Aren’t HTTP connections are supposed to be stateless?
