class Cannon::Rpc::TcpConnection
Overview
A TCP-based network connection. See Connection
for usage details.
This connection allows for concurrent requests, up to 256 at once.
Defined in:
cannon/rpc/tcp_connection.crConstructors
-
.new(manager : Manager, socket : TCPSocket)
Creates a connection using the given manager and communicating through the given socket.
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).
-
#release_remote_service(service_id : UInt32)
Releases the remote service_id
-
#run
Starts a read-loop, blocking the current Fiber.
Instance methods inherited from class Cannon::Rpc::Connection
call_remotely(service_id : UInt32, function_hash : UInt32, arguments : Tuple | Nil, &block : IO -> _)call_remotely(service_id : UInt32, function_hash : UInt32, arguments : Tuple | Nil) call_remotely, close close, manager : Manager manager, on_local_error(&block : Exception -> _) on_local_error, on_remote_error(&block : RemoteError -> _) on_remote_error, release_remote_service(service_id : UInt32) release_remote_service, release_service(service_id : UInt32) release_service, run run, running? : Bool running?
Constructor methods inherited from class Cannon::Rpc::Connection
new(manager : Manager)
new
Class methods inherited from class Object
to_cannon_io(io, value)
to_cannon_io
Constructor Detail
Creates a connection using the given manager and communicating through the given socket.
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.
Closes the connection gracefully (if possible).
Releases the remote service_id