Class: Thin::Request
- Inherits:
-
Object
show all
- Defined in:
- lib/thin_extensions.rb
Defined Under Namespace
Classes: Protocol75, Protocol76, WebSocketHandler
Constant Summary
collapse
- WEBSOCKET_RECEIVE_CALLBACK =
'websocket.receive_callback'.freeze
Instance Method Summary
collapse
Instance Method Details
#websocket? ⇒ Boolean
57
58
59
|
# File 'lib/thin_extensions.rb', line 57
def websocket?
@env['HTTP_CONNECTION'] == 'Upgrade' && @env['HTTP_UPGRADE'] == 'WebSocket'
end
|
#websocket_upgrade_data ⇒ Object
65
66
67
68
69
70
71
72
|
# File 'lib/thin_extensions.rb', line 65
def websocket_upgrade_data
handler = if @env['HTTP_SEC_WEBSOCKET_KEY1'] and @env['HTTP_SEC_WEBSOCKET_KEY2']
Protocol76
else
Protocol75
end
handler.new(self).handshake
end
|
#websocket_url ⇒ Object
61
62
63
|
# File 'lib/thin_extensions.rb', line 61
def websocket_url
@env['websocket.url'] = "ws://#{@env['HTTP_HOST']}#{@env['REQUEST_PATH']}"
end
|