jamwt/diesel — pull request #50 by dowski (2012-11-10 20:33:52+00:00)
Title: WebSockets protocol fixes and improvements.

Fixes to disconnect behavior. Clients can now cleanly
disconnect/reconnect and exceptions due to data being left in the
receive buffers are gone.

Also changes the way WebSockets integrate internally. The HttpServer is
now generally aware of "101 Switching Protocols" responses and will
attempt to call a `new_protocol` callable on the Response object. This
works around some errors that were happening due to Flask not seeing a
response on a disconnect (do to the `do_upgrade` function returning
None).

Many thanks to Sébastien Arnaud for discovering these bugs and for the
proper two-phase disconnect code that he contributed (and is included
here).