pub fn write_frame(
writer: &mut impl Write,
message: Message,
max_frame_bytes: u32,
) -> Result<(), ProtocolError>Expand description
Serialise message as a length-delimited JSON frame to writer.
max_frame_bytes is the per-frame cap negotiated for this connection.
Until the handshake completes, callers pass MAX_FRAME_BYTES as the
default; afterwards the supervisor passes the
Message::ConfigureFrameLimit value installed on the connection.
ยงErrors
Returns ProtocolError::FrameTooLarge if the serialised body would
exceed max_frame_bytes, or the underlying ProtocolError::Io /
ProtocolError::Json for codec failures.