class SimpleRpc::Client
- SimpleRpc::Client
- Reference
- Object
Defined in:
simple_rpc/client.crConstructors
Instance Method Summary
- #close
- #mode : SimpleRpc::Client::Mode
- #notify!(name, *args)
- #pool : ConnectionPool(Connection) | Nil
-
#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
Constructor Detail
def self.new(host : String, port : Int32, command_timeout : Float64 | Nil = nil, connect_timeout : Float64 | Nil = nil, mode : Mode = Mode::ConnectPerRequest, pool_size : Int32 = 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(Float64) 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