class ActionCable::Connection::FayeClientSocket
Public Class Methods
new(env, event_target, stream_event_loop, protocols)
click to toggle source
# File lib/action_cable/connection/faye_client_socket.rb, line 6 def initialize(env, event_target, stream_event_loop, protocols) @env = env @event_target = event_target @protocols = protocols @faye = nil end
Public Instance Methods
alive?()
click to toggle source
# File lib/action_cable/connection/faye_client_socket.rb, line 14 def alive? @faye && @faye.ready_state == Faye::WebSocket::API::OPEN end
close()
click to toggle source
# File lib/action_cable/connection/faye_client_socket.rb, line 23 def close @faye && @faye.close end
protocol()
click to toggle source
# File lib/action_cable/connection/faye_client_socket.rb, line 27 def protocol @faye && @faye.protocol end
rack_response()
click to toggle source
# File lib/action_cable/connection/faye_client_socket.rb, line 31 def rack_response connect @faye.rack_response end
transmit(data)
click to toggle source
# File lib/action_cable/connection/faye_client_socket.rb, line 18 def transmit(data) connect @faye.send data end
Private Instance Methods
connect()
click to toggle source
# File lib/action_cable/connection/faye_client_socket.rb, line 37 def connect return if @faye @faye = Faye::WebSocket.new(@env, @protocols) @faye.on(:open) { |event| @event_target.on_open } @faye.on(:message) { |event| @event_target.on_message(event.data) } @faye.on(:close) { |event| @event_target.on_close(event.reason, event.code) } @faye.on(:error) { |event| @event_target.on_error(event.message) } end