Sha256: 79ee80b52b7e56759ce853b88a2b3d4fa8018e12e30c3f0ce9db9ad4fd5bfd50
Contents?: true
Size: 951 Bytes
Versions: 1
Compression:
Stored size: 951 Bytes
Contents
require "nio/websocket/raw_adapter" module NIO module WebSocket class Adapter class Proxy 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 attr_reader :srv_adapter, :client_adapter def add_to_reactor srv_adapter.add_to_reactor client_adapter.add_to_reactor end end class ProxyAdapter < RawAdapter def initialize(io, options, &block) super io, options @read_event = block end def read super do |data| @read_event.call data end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nio4r-websocket-0.7.0 | lib/nio/websocket/adapter/proxy.rb |