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.cr

Constructors

Instance Method Summary

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

def self.new(manager : Manager, socket : TCPSocket) #

Creates a connection using the given manager and communicating through the given socket.


[View source]

Instance Method Detail

def call_remotely(service_id : UInt32, function_hash : UInt32, arguments : Tuple | Nil, &block : IO -> _) #
Description copied from class Cannon::Rpc::Connection

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.


[View source]
def call_remotely(service_id : UInt32, function_hash : UInt32, arguments : Tuple | Nil) #
Description copied from class Cannon::Rpc::Connection

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.


[View source]
def close #
Description copied from class Cannon::Rpc::Connection

Closes the connection gracefully (if possible).


[View source]
def release_remote_service(service_id : UInt32) #
Description copied from class Cannon::Rpc::Connection

Releases the remote service_id


[View source]
def run #

Starts a read-loop, blocking the current Fiber.


[View source]