encodeEnvelope
encodeEnvelope(
env):string
Defined in: packages/protocol/src/lib/envelope.ts:440
Serializes any envelope to the wire string. The inverse of the decode*
functions; a plain JSON encode, isolated here so the contract has one
encode/decode pair callers can reach for.
Parameters
Section titled “Parameters”ClientEnvelope | ServerEnvelope
Returns
Section titled “Returns”string
Example
Section titled “Example”// connector side (client → engine host)ws.send(encodeEnvelope(ChartRequestMessage({ sessionId, request })));// host side (engine host → client)ws.send(encodeEnvelope(EngineErrorMessage({ error: 'boom', requestId })));