Detecting cancelled request using Rack

Hi all,

I was wondering whether it’s possible to detect a cancelled request in
Rack
or in web frameworks including Rails and Sinatra. I’m experimenting with
a
little Comet library and want a way to shut down message listeners in
the
server-side process if a long-running request from the client is
interrupted.

Thanks,
James