Class: Foxbat::Client
- Inherits:
-
Object
- Object
- Foxbat::Client
- Defined in:
- lib/foxbat/client.rb
Instance Method Summary collapse
-
#initialize(host, port, klass, options, &block) ⇒ Client
constructor
A new instance of Client.
- #start(threadpool) ⇒ Object
Constructor Details
#initialize(host, port, klass, options, &block) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 |
# File 'lib/foxbat/client.rb', line 8 def initialize(host, port, klass, , &block) if [:secure] @context = Security.setup_ssl_client_context end @group = DefaultChannelGroup.new @address = InetSocketAddress.new(host, port) @pipeline = Pipeline.new(klass, @group, true, , @context, &block) end |
Instance Method Details
#start(threadpool) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/foxbat/client.rb', line 18 def start(threadpool) factory = NioClientSocketChannelFactory.new(threadpool, threadpool) @bootstrap = ClientBootstrap.new(factory) @bootstrap.setPipelineFactory(@pipeline) @bootstrap.setOption("child.tcpNoDelay", true) @bootstrap.setOption("child.keepAlive", true) @bootstrap.connect(@address) end |