Class: ActionCable::Server::Socket::WebSocket
- Inherits:
-
Object
- Object
- ActionCable::Server::Socket::WebSocket
- Defined in:
- lib/action_cable/server/socket/web_socket.rb
Overview
# Action Cable Connection WebSocket
Wrap the real socket to minimize the externally-presented API
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #close ⇒ Object
-
#initialize(env, event_target, event_loop, protocols: ActionCable::INTERNAL[:protocols]) ⇒ WebSocket
constructor
:nodoc:.
- #possible? ⇒ Boolean
- #protocol ⇒ Object
- #rack_response ⇒ Object
- #transmit ⇒ Object
Constructor Details
#initialize(env, event_target, event_loop, protocols: ActionCable::INTERNAL[:protocols]) ⇒ WebSocket
:nodoc:
14 15 16 |
# File 'lib/action_cable/server/socket/web_socket.rb', line 14 def initialize(env, event_target, event_loop, protocols: ActionCable::INTERNAL[:protocols]) @websocket = ::WebSocket::Driver.websocket?(env) ? ClientSocket.new(env, event_target, event_loop, protocols) : nil end |
Instance Method Details
#alive? ⇒ Boolean
22 23 24 |
# File 'lib/action_cable/server/socket/web_socket.rb', line 22 def alive? websocket&.alive? end |
#close ⇒ Object
30 31 32 |
# File 'lib/action_cable/server/socket/web_socket.rb', line 30 def close(...) websocket&.close(...) end |
#possible? ⇒ Boolean
18 19 20 |
# File 'lib/action_cable/server/socket/web_socket.rb', line 18 def possible? websocket end |
#protocol ⇒ Object
34 35 36 |
# File 'lib/action_cable/server/socket/web_socket.rb', line 34 def protocol websocket&.protocol end |
#rack_response ⇒ Object
38 39 40 |
# File 'lib/action_cable/server/socket/web_socket.rb', line 38 def rack_response websocket&.rack_response end |
#transmit ⇒ Object
26 27 28 |
# File 'lib/action_cable/server/socket/web_socket.rb', line 26 def transmit(...) websocket&.transmit(...) end |