findStateToken
function findStateToken(data): Promise<string | null>;Defined in: src/wire/public.ts:117
Return the stream-state continuation token carried in a request/response body.
The token (vgi_rpc.stream_state#b64) rides in a record batch’s
custom_metadata — not a header. Stream continuations recover their state
from it, never from headers, so an intermediary routing or correlating a
stream by it must read the batch metadata.
Two body shapes are handled by one walk: an exchange request is a single IPC stream whose first batch carries the token; a producer init/exchange response may be several concatenated IPC streams (a header stream followed by the producer’s data stream), so the token can be in a later stream.
Returns the first token found across all concatenated streams, or null when
absent or the body is unparseable. For a response that rotates the token
across several data batches the last token is the continuation the peer
will send next; this returns the first. Single-token responses (the common
case) make them identical.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
data |
Uint8Array |
Returns
Section titled “Returns”Promise<string | null>
