abstract class ACP::Transport

Overview

Abstract base class for all ACP transports. Subclasses must implement the raw read/write operations; the base class provides the JSON parsing/serialization layer on top.

Direct Known Subclasses

Defined in:

acp/transport.cr

Instance Method Summary

Instance Method Detail

abstract def close : Nil #

Closes the transport, releasing any underlying resources.


[View source]
abstract def closed? : Bool #

Returns true if the transport is open and operational.


[View source]
abstract def receive : JSON::Any | Nil #

Receives the next incoming JSON message, blocking until one arrives. Returns nil if the transport is closed.


[View source]
abstract def send(message : Hash(String, JSON::Any)) : Nil #

Sends a JSON-RPC message (Hash serialized to JSON + newline).


[View source]
def send_json(obj : Hash(String, JSON::Any)) : Nil #

Convenience: send a JSON::Serializable object that has already been wrapped in the JSON-RPC envelope.


[View source]