struct Movie::Remote::WireEnvelope

Overview

WireEnvelope is the envelope used for serializing messages over the wire. Connection-owned decoders can retain registered payloads as typed wrappers; stateless, unknown, and payload-before-type decoding retains raw JSON. All outbound serializable values write directly to JSON::Builder.

Defined in:

movie/remote/wire_envelope.cr

Constructors

Instance Method Summary

Constructor Detail

def self.ask_request(target_path : String, message_type : String, payload : P, correlation_id : String, sender_path : String | Nil = nil) : WireEnvelope forall P #

Creates an ask request envelope.


[View source]
def self.ask_response(target_path : String, message_type : String, payload : P, correlation_id : String) : WireEnvelope forall P #

Creates an ask response envelope.


[View source]
def self.control_ack(stream : String, sequence : Int64) : WireEnvelope #

[View source]
def self.handshake(system_name : String, address : String) : WireEnvelope #

Compatibility helper for callers that do not need custom association settings. It still emits the current versioned handshake.


[View source]
def self.handshake(handshake : AssociationHandshake) : WireEnvelope #

Creates a handshake envelope.


[View source]
def self.handshake_ack(handshake : AssociationHandshake) : WireEnvelope #

[View source]
def self.handshake_confirm(confirmation : AssociationConfirmation) : WireEnvelope #

[View source]
def self.handshake_ready(association_id : String) : WireEnvelope #

[View source]
def self.handshake_reject(reason : String) : WireEnvelope #

[View source]
def self.heartbeat : WireEnvelope #

Creates a heartbeat envelope.


[View source]
def self.heartbeat_ack : WireEnvelope #

[View source]
def self.new(kind : Kind, target_path : String, message_type : String, payload : P, correlation_id : String | Nil = nil, sender_path : String | Nil = nil, timestamp : Int64 = Time.utc.to_unix_ms, control_stream : String | Nil = nil, control_sequence : Int64 | Nil = nil) forall P #

[View source]
def self.new(pull : JSON::PullParser, payload_decoder : JsonPayloadDecoder | Nil = nil) #

[View source]
def self.system_message(target_path : String, message_type : String, payload : P, sender_path : String | Nil = nil) : WireEnvelope forall P #

Creates a system message envelope.


[View source]
def self.user_message(target_path : String, message_type : String, payload : P, sender_path : String | Nil = nil) : WireEnvelope forall P #

Creates a user message envelope.


[View source]

Instance Method Detail

def control_sequence : Int64 | Nil #

[View source]
def control_sequence=(control_sequence : Int64 | Nil) #

[View source]
def control_stream : String | Nil #

[View source]
def control_stream=(control_stream : String | Nil) #

[View source]
def correlation_id : String | Nil #

[View source]
def correlation_id=(correlation_id : String | Nil) #

[View source]
def kind : Kind #

[View source]
def kind=(kind : Kind) #

[View source]
def message_type : String #

[View source]
def message_type=(message_type : String) #

[View source]
def payload : JSON::Any #

Dynamic payload access is materialized lazily. Normal registered message delivery uses payload_data and does not build JSON::Any.


[View source]
def payload=(value : JSON::Any) : JSON::Any #

[View source]
def payload_data : JsonPayload #

[View source]
def sender_path : String | Nil #

[View source]
def sender_path=(sender_path : String | Nil) #

[View source]
def target_path : String #

[View source]
def target_path=(target_path : String) #

[View source]
def timestamp : Int64 #

[View source]
def timestamp=(timestamp : Int64) #

[View source]
def to_json(json : JSON::Builder) : Nil #

[View source]