class SimpleRpc::Client

Defined in:

simple_rpc/client.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(host : String = "127.0.0.1", port : Int32 = 9999, unixsocket : String | Nil = nil, ssl_context : OpenSSL::SSL::Context::Client | Nil = nil, command_timeout : Float64 | Nil = nil, connect_timeout : Float64 | Nil = nil, mode : Mode = Mode::ConnectPerRequest, pool_size = 20, pool_timeout = 5.0, create_connection_retries : Int32 = 0, create_connection_retry_interval : Float64 = 0.5) #

[View source]

Instance Method Detail

def close #

[View source]
def command_timeout : Float64? #

[View source]
def connect_timeout : Float64? #

[View source]
def host : String #

[View source]

[View source]
def notify!(name, *args) #

[View source]
def pool : ConnectionPool(Connection) | Nil #

[View source]
def port : Int32 #

[View source]
def raw_request(method, args, msgid = SimpleRpc::DEFAULT_MSG_ID, &) #

[View source]
def request(klass : T.class, name, *args) forall T #

Execute request, not raising errors First argument is a return type, then method and args

example: res = SimpleRpc::Client.request(type, method, *args) # => SimpleRpc::Result(type) res = SimpleRpc::Client.request(Float64, :bla, 1, "2.5") # => SimpleRpc::Result(Float64)

if res.ok?
  p res.value! # => Float64
else
  p res.error! # => SimpleRpc::Errors
end

[View source]
def request!(klass : T.class, name, *args) forall T #

[View source]
def single : Connection | Nil #

[View source]
def ssl_context : OpenSSL::SSL::Context::Client? #

[View source]
def unixsocket : String? #

[View source]