Documentation
¶
Index ¶
Constants ¶
const ( CompressedFlag byte = 0x01 // Message is compressed EndStreamFlag byte = 0x02 // Final message in stream )
Envelope protocol flags
Variables ¶
This section is empty.
Functions ¶
func CompressEnvelopeIfLarge ¶ added in v1.44.0
func CompressEnvelopeIfLarge(payload []byte, threshold int) (compressed []byte, wasCompressed bool, err error)
CompressEnvelopeIfLarge gzip-compresses payload when it exceeds threshold bytes, returning the compressed bytes and wasCompressed=true. Payloads at or under the threshold are returned unmodified with wasCompressed=false so callers can decide whether to set the envelope's CompressedFlag (see CompressedFlag, above) before writing the frame.
server/services/connectrpc_websocket.go's writeCurrentPaneResponse is the shared envelope-writing helper that calls this; all CurrentPaneRequest response paths route through it so compression is applied uniformly.
func CreateEnvelope ¶
CreateEnvelope creates an envelope with the given flags and data.
Types ¶
type Envelope ¶
Envelope represents a ConnectRPC envelope message with flags and data. Format: [1 byte flags][4 bytes length][N bytes data]
func ParseEnvelope ¶
ParseEnvelope reads an envelope from the provided data. Returns the parsed envelope and any remaining unconsumed data.
func ReadEnvelope ¶
ReadEnvelope reads a single envelope from an io.Reader.
func (*Envelope) IsCompressed ¶
IsCompressed checks if the envelope has the Compressed flag set.
func (*Envelope) IsEndStream ¶
IsEndStream checks if the envelope has the EndStream flag set.