class SimpleRpc::Client
- SimpleRpc::Client
- Reference
- Object
Defined in:
simple_rpc/client.crConstructors
Instance Method Summary
- #close
- #command_timeout : Float64?
- #connect_timeout : Float64?
- #host : String
- #mode : SimpleRpc::Client::Mode
- #notify!(name, *args)
- #pool : ConnectionPool(Connection) | Nil
- #port : Int32
- #raw_request(method, msgid = SimpleRpc::DEFAULT_MSG_ID, &)
-
#request(klass : T.class, name, *args) forall T
Execute request, not raising errors First argument is a return type, then method and args
- #request!(klass : T.class, name, *args) forall T
- #single : Connection | Nil
- #ssl_context : OpenSSL::SSL::Context::Client?
- #unixsocket : String?
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)
#
Instance Method Detail
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