Skip to main content

read_frame

Function read_frame 

Source
pub fn read_frame(
    reader: &mut impl Read,
    max_frame_bytes: u32,
) -> Result<Frame, ProtocolError>
Expand description

Read one length-delimited JSON frame from reader.

max_frame_bytes is the per-frame cap negotiated for this connection. See write_frame for the back-compat default and post-handshake semantics.

§Errors

Returns ProtocolError::FrameTooLarge if the framed length exceeds max_frame_bytes (rejected before allocation), ProtocolError::VersionMismatch if the peer’s version does not match PROTOCOL_VERSION, or the underlying ProtocolError::Io / ProtocolError::Json for codec failures.