Skip to main content

read_message

Function read_message 

Source
pub async fn read_message(
    reader: &mut (impl AsyncReadExt + Unpin),
) -> Result<Value, NativeMessageError>
Expand description

Read one native messaging frame from stdin.

Chrome sends: 4-byte little-endian length prefix, then UTF-8 JSON. Maximum input size is 1 MB per Chrome’s spec.

§Errors

Returns an error if the message exceeds the 1 MB limit, if the read fails, or if the bytes are not valid JSON.