Class: JRPC::TcpClient

Inherits:
BaseClient show all
Defined in:
lib/jrpc/tcp_client.rb

Constant Summary

Constants inherited from BaseClient

BaseClient::ID_CHARACTERS

Instance Attribute Summary collapse

Attributes inherited from BaseClient

#options, #uri

Instance Method Summary collapse

Methods inherited from BaseClient

#invoke_notification, #invoke_request, #method_missing

Constructor Details

#initialize(uri, options = {}) ⇒ TcpClient

Returns a new instance of TcpClient.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/jrpc/tcp_client.rb', line 8

def initialize(uri, options = {})
  super
  @namespace = @options.delete(:namespace).to_s
  t = @options.fetch(:timeout, 5)

  @client = Net::TCPClient.new server: @uri,
                               connect_retry_count: t,
                               connect_timeout: t,
                               read_timeout: t, # write_timeout: t,
                               buffered: false, # recommended for RPC
                               logger: @options.delete(:logger),
                               log_level: @options.delete(:log_level)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JRPC::BaseClient

Instance Attribute Details

#namespaceObject (readonly)

Returns the value of attribute namespace.



5
6
7
# File 'lib/jrpc/tcp_client.rb', line 5

def namespace
  @namespace
end