123456789_123456789_123456789_123456789_123456789_

Class: ActionCable::Connection::WebSocket

Do not use. This class is for internal use only.
Relationships & Source Files
Inherits: Object
Defined in: actioncable/lib/action_cable/connection/web_socket.rb

Overview

Wrap the real socket to minimize the externally-presented API

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(env, event_target, event_loop, protocols: ActionCable::INTERNAL[:protocols]) ⇒ WebSocket

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/web_socket.rb', line 13

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 Attribute Details

#alive?Boolean (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/web_socket.rb', line 21

def alive?
  websocket&.alive?
end

#possible?Boolean (readonly)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/web_socket.rb', line 17

def possible?
  websocket
end

#websocket (readonly, private)

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/web_socket.rb', line 42

attr_reader :websocket

Instance Method Details

#close

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/web_socket.rb', line 29

def close(...)
  websocket&.close(...)
end

#protocol

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/web_socket.rb', line 33

def protocol
  websocket&.protocol
end

#rack_response

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/web_socket.rb', line 37

def rack_response
  websocket&.rack_response
end

#transmit

[ GitHub ]

  
# File 'actioncable/lib/action_cable/connection/web_socket.rb', line 25

def transmit(...)
  websocket&.transmit(...)
end