abstract class Cannon::Rpc::Connection
- Cannon::Rpc::Connection
- Reference
- Object
Overview
A (network) connection to invoke remote methods.
Use a RemoteService
instead of using the methods in this class directly.
Direct Known Subclasses
Defined in:
cannon/rpc/connection.crConstructors
Instance Method Summary
-
#call_remotely(service_id : UInt32, function_hash : UInt32, arguments : Tuple | Nil, &block : IO -> _)
Calls the function (through function_hash) on service_id using arguments.
-
#call_remotely(service_id : UInt32, function_hash : UInt32, arguments : Tuple | Nil)
Like
#call_remotely
, but doesn't request a response. -
#close
Closes the connection gracefully (if possible).
-
#manager : Manager
The
Manager
used to offer services to the remote side. -
#on_local_error(&block : Exception -> _)
Sets a handler called when a locally called method threw an error.
-
#on_remote_error(&block : RemoteError -> _)
Sets a handler called when a remotely called method threw an error.
-
#release_remote_service(service_id : UInt32)
Releases the remote service_id
-
#release_service(service_id : UInt32)
Releases the local service_id, requested by this connection.
-
#run
Starts a read-loop, blocking the current Fiber.
-
#running? : Bool
Is the connection running?
Class methods inherited from class Object
to_cannon_io(io, value)
to_cannon_io
Constructor Detail
Instance Method Detail
Calls the function (through function_hash) on service_id using
arguments. Yields an IO
when the response was received and must
be read from it using Cannon.decode
. If a remote error was
encountered, the block is not called, and is raised locally.
This method blocks the current Fiber.
Like #call_remotely
, but doesn't request a response. A response is
never requested and thus is never received.
Note: This will also silence any error propagation from the remote side back to the local side.
This method does not block the current Fiber.
Sets a handler called when a locally called method threw an error.
Sets a handler called when a remotely called method threw an error.
Releases the remote service_id
Releases the local service_id, requested by this connection.