Class: Tep::WebSocket::Handler
- Inherits:
-
Object
- Object
- Tep::WebSocket::Handler
- Defined in:
- lib/tep/websocket/driver.rb
Overview
Base class for event handlers. Subclass + override
handle_event(event). The Driver stores one Handler instance
per event type and dispatches via @h_message.handle_event(evt).
The explicit-Handler shape (vs faye's block-based driver.on(:msg) { ... }) is chosen because it stays compatible with future
Fiber.storage per-connection state plumbing without re-typing
the callback boundary.
req is set at WS upgrade time by the route handler the
translator emits, giving on_X handler bodies access to the
request that initiated the connection (req.identity,
req.session, headers, ...). It stays the same across every
event on the connection -- there's no per-frame "request".
Instance Attribute Summary collapse
-
#req ⇒ Object
Returns the value of attribute req.
Instance Method Summary collapse
- #handle_event(event) ⇒ Object
-
#initialize ⇒ Handler
constructor
A new instance of Handler.
Constructor Details
Instance Attribute Details
#req ⇒ Object
Returns the value of attribute req.
158 159 160 |
# File 'lib/tep/websocket/driver.rb', line 158 def req @req end |
Instance Method Details
#handle_event(event) ⇒ Object
164 165 166 |
# File 'lib/tep/websocket/driver.rb', line 164 def handle_event(event) 0 end |