Class: NIO::WebSocket::Adapter::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/nio/websocket/adapter/proxy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(srv, client, options) ⇒ Proxy

Returns a new instance of Proxy.



7
8
9
10
11
12
13
14
15
# File 'lib/nio/websocket/adapter/proxy.rb', line 7

def initialize(srv, client, options)
  @srv_adapter = ProxyAdapter.new srv, options do |data|
    client_adapter.write data
  end
  @client_adapter = ProxyAdapter.new client, options do |data|
    srv_adapter.write data
  end
  WebSocket.logger.debug "Initiating proxy connection between #{srv} and #{client}"
end

Instance Attribute Details

#client_adapterObject (readonly)

Returns the value of attribute client_adapter.



16
17
18
# File 'lib/nio/websocket/adapter/proxy.rb', line 16

def client_adapter
  @client_adapter
end

#srv_adapterObject (readonly)

Returns the value of attribute srv_adapter.



16
17
18
# File 'lib/nio/websocket/adapter/proxy.rb', line 16

def srv_adapter
  @srv_adapter
end

Instance Method Details

#add_to_reactorObject



18
19
20
21
# File 'lib/nio/websocket/adapter/proxy.rb', line 18

def add_to_reactor
  srv_adapter.add_to_reactor
  client_adapter.add_to_reactor
end