liris/websocket-client — pull request #111 by ekeydar (2014-10-05 07:18:18+00:00)
Title: support for code and reason in on_close callback

I'm using this code for testing of websocket server implementation that uses tornado 4.0.
Tornado 4.0 supports passing code and reason for close websocket, howver this client does not support it.

Javascript standard implementation support this (https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent)

This pull request tries to add this support, it checks using inspect if the on_close callback has 3 arguments (or *args or **kwargs), and if so pass the code and reason extracted from the frame.data.

Hope it will help.
Eran