0
Fork 0
mirror of https://github.com/TanStack/ai.git synced 2026-11-16 19:38:41 +00:00
ai/docs/reference/functions/encodeWsFrame.md
github-actions[bot] f4f32bdcc2
docs: regenerate API documentation (#1195)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-08-22 08:16:20 +00:00

666 B

id title
encodeWsFrame encodeWsFrame

Function: encodeWsFrame()

function encodeWsFrame(chunk, id): string;

Defined in: packages/ai/src/stream-to-websocket.ts:35

Encode one server→client frame. Durable frames carry the opaque offset in an { id, chunk } envelope (identical to the NDJSON wire); non-durable frames are the bare chunk. Unambiguous because a bare chunk always has a top-level type and the envelope never does.

Parameters

chunk

AGUIEvent

id

string | undefined

Returns

string