Request handlers¶
Tornadose defines handlers for using the EventSource interface or
WebSockets. For other handlers, the BaseHandler
class is
provided.
-
class
tornadose.handlers.
BaseHandler
(application, request, **kwargs)[source]¶ Bases:
tornado.web.RequestHandler
Base handler for subscribers. To be compatible with data stores defined in
tornadose.stores
, custom handlers should inherit this class and implement thepublish()
method.-
initialize
(store)[source]¶ Common initialization of handlers happens here. If additional initialization is required, this method must either be called with
super
or the child class must assign thestore
attribute and register itself with the store.
-
-
class
tornadose.handlers.
EventSource
(application, request, **kwargs)[source]¶ Bases:
tornadose.handlers.BaseHandler
Handler for server-sent events a.k.a. EventSource.
The EventSource interface has a few advantages over websockets:
-
class
tornadose.handlers.
WebSocketSubscriber
(application, request, **kwargs)[source]¶ Bases:
tornadose.handlers.BaseHandler
,tornado.websocket.WebSocketHandler
A Websocket-based subscription handler.