on_open and open of tornado.websocket.WebSocketHandler

94 views
Skip to first unread message

shinriyo

unread,
May 20, 2012, 12:28:31 PM5/20/12
to Tornado Web Server
Hi there

I read Introduction to tornado book

I use websocket and extend the tornado.websocket.WebSocketHandler
class.

It have open and on_open methods.
They are same? or different?
or I guess they are alias method

Thank you.

Ben Darnell

unread,
May 20, 2012, 1:32:48 PM5/20/12
to python-...@googlegroups.com
It's just open(); there is no on_open(). The other methods are
on_message() and on_close() so it probably should have been on_open()
for consistency. (on the javascript side, the methods are onopen and
onmessage, without the underscore).

-Ben

Serge S. Koval

unread,
May 20, 2012, 6:22:48 PM5/20/12
to python-...@googlegroups.com
While sockjs-tornado mimics tornado websocket API, but I decided to make it consistent with on_message/on_close, so it is called on_open.

Not a big deal to rename it to open() if someone will want to switch to native tornado websocket implementation.

Serge.

shinriyo

unread,
May 24, 2012, 10:19:14 PM5/24/12
to python-...@googlegroups.com
Thnak you for replying.

so, on_open() is errata? right?
I e-mailed to the author.

sockjs-tornado is yours version?

Thank you

Reply all
Reply to author
Forward
0 new messages