module Cannon::Rpc::RemoteService(T)
Overview
Include this into a client class to access a specific remote service
through a Connection
.
The T
is the description module. For all public methods in T
a
method will be generated, which forwards the call to the remote end. By
default, the invocation will wait for a response to return it, or to raise
a RemoteError
when an error occured. Each method also exists in a
without_response
version, which if used, will not wait for the remote
end to finish the work. This also means that any result (or encountered
error) will be silently dropped.
Calling Example
my_service = MyServiceClient.new(my_connection, the_identifier)
pp my_service.greet("You") # Will wait for the response
pp my_service.greet_without_response("You") # Will NOT wait
Please see samples/rpc
for a complete usage example.
Defined in:
cannon/rpc/remote_service.crConstructors
-
.new(connection : Connection, service_id : UInt32, owned : Bool = false)
Instantiates a client over connection to the service.
Instance Method Summary
-
#connection : Connection
The connection used to reach the remote
Service
object -
#finalize
Release the remote service on garbage-collection.
-
#owned? : Bool
Do we own this service?
-
#release_now!
Releases ("free's") the remote service if we own it.
-
#service_id : UInt32
The id of the remote
Service
object
Constructor Detail
Instantiates a client over connection to the service.