class ActionCable::Connection::WebSocket

Parent:
Object

Wrap the real socket to minimize the externally-presented API

Attributes

websocket[R]

Public Class Methods

new(env, event_target, event_loop, client_socket_class, protocols: ActionCable::INTERNAL[:protocols]) Show source
# File actioncable/lib/action_cable/connection/web_socket.rb, line 7
def initialize(env, event_target, event_loop, client_socket_class, protocols: ActionCable::INTERNAL[:protocols])
  @websocket = ::WebSocket::Driver.websocket?(env) ? client_socket_class.new(env, event_target, event_loop, protocols) : nil
end

Public Instance Methods

alive?() Show source
# File actioncable/lib/action_cable/connection/web_socket.rb, line 15
def alive?
  websocket && websocket.alive?
end
close() Show source
# File actioncable/lib/action_cable/connection/web_socket.rb, line 23
def close
  websocket.close
end
possible?() Show source
# File actioncable/lib/action_cable/connection/web_socket.rb, line 11
def possible?
  websocket
end
protocol() Show source
# File actioncable/lib/action_cable/connection/web_socket.rb, line 27
def protocol
  websocket.protocol
end
rack_response() Show source
# File actioncable/lib/action_cable/connection/web_socket.rb, line 31
def rack_response
  websocket.rack_response
end
transmit(data) Show source
# File actioncable/lib/action_cable/connection/web_socket.rb, line 19
def transmit(data)
  websocket.transmit data
end

© 2004–2018 David Heinemeier Hansson
Licensed under the MIT License.