class Movie::Remote::FrameCodec::Encoder

Overview

Stateful encoder with a reusable JSON buffer. It is not thread-safe and must be owned by one caller (normally a connection's outbound writer).

Defined in:

movie/remote/frame_codec.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(initial_capacity : Int32 = INITIAL_BUFFER_CAPACITY) #

[View source]

Instance Method Detail

def append(envelope : WireEnvelope, io : IO) : Nil #

Appends one complete length-prefixed frame without flushing the target. This lets a connection writer concatenate ready frames into one write.


[View source]
def encode(envelope : WireEnvelope, io : IO) : Nil #

[View source]
def with_frame(envelope : WireEnvelope, & : Bytes -> ) : Nil #

Yields a complete frame from the reusable encoder buffer. The slice is only valid for the duration of the block.


[View source]