Class: ActionCable::Connection::FayeClientSocket

Inherits:
Object
  • Object
show all
Defined in:
lib/action_cable/connection/faye_client_socket.rb

Instance Method Summary collapse

Constructor Details

#initialize(env, event_target, stream_event_loop, protocols) ⇒ FayeClientSocket

Returns a new instance of FayeClientSocket.



6
7
8
9
10
11
12
# 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

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/action_cable/connection/faye_client_socket.rb', line 14

def alive?
  @faye && @faye.ready_state == Faye::WebSocket::API::OPEN
end

#closeObject



23
24
25
# File 'lib/action_cable/connection/faye_client_socket.rb', line 23

def close
  @faye && @faye.close
end

#protocolObject



27
28
29
# File 'lib/action_cable/connection/faye_client_socket.rb', line 27

def protocol
  @faye && @faye.protocol
end

#rack_responseObject



31
32
33
34
# File 'lib/action_cable/connection/faye_client_socket.rb', line 31

def rack_response
  connect
  @faye.rack_response
end

#transmit(data) ⇒ Object



18
19
20
21
# File 'lib/action_cable/connection/faye_client_socket.rb', line 18

def transmit(data)
  connect
  @faye.send data
end