Module: Skinny::Helpers
- Defined in:
- lib/skinny.rb
Instance Method Summary collapse
- #websocket(options = {}, &block) ⇒ Object
- #websocket!(options = {}, &block) ⇒ Object
- #websocket? ⇒ Boolean
Instance Method Details
#websocket(options = {}, &block) ⇒ Object
438 439 440 441 442 443 444 |
# File 'lib/skinny.rb', line 438 def websocket ={}, &block env[SKINNY_WEBSOCKET] ||= begin raise RuntimerError, "Not a WebSocket request" unless websocket? [:on_message] = block if block_given? Websocket.from_env(env, ) end end |
#websocket!(options = {}, &block) ⇒ Object
446 447 448 |
# File 'lib/skinny.rb', line 446 def websocket! ={}, &block websocket(, &block).start! end |
#websocket? ⇒ Boolean
434 435 436 |
# File 'lib/skinny.rb', line 434 def websocket? env[CONNECTION] =~ UPGRADE_REGEXP && env[UPGRADE] =~ WEBSOCKET_REGEXP end |