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 11

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 19

def alive?
  websocket && websocket.alive?
end

#possible?Boolean (readonly)

[ GitHub ]

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

def possible?
  websocket
end

#websocket (readonly, private)

[ GitHub ]

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

attr_reader :websocket

Instance Method Details

#close

[ GitHub ]

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

def close
  websocket.close
end

#protocol

[ GitHub ]

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

def protocol
  websocket.protocol
end

#rack_response

[ GitHub ]

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

def rack_response
  websocket.rack_response
end

#transmit(data)

[ GitHub ]

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

def transmit(data)
  websocket.transmit data
end