Skip to content
English

传输与流 ​

Support · 推荐实现与策略 · 返回本层目录

符号类别用途
encodeSseEventfunctionEncode one event in the server-sent events wire format. Every line of data gets its own data: field, because a raw newline would start a new field.
JsonFrameLimitsinterfaceBounds applied while scanning a streamed text.
JsonTransportParttypeOne scanned span: a complete object frame or a character outside any frame.
parseJsonFramesfunctionParse complete object frames under explicit count and size limits. Only whitespace may appear outside frames; a stray closing brace is tolerated only up to maxExtraClosings, which covers transports that repeat the delimiter after the payload.
scanJsonObjectFramesfunctionExtract complete object-shaped spans from surrounding text, without parsing or selecting them.
SseOutputEventinterfaceOne outbound event before wire encoding.
SseWriterinterfaceDestination that reports backpressure instead of buffering without bound.
writeSseFramefunctionWrite one encoded frame and wait for drain when the writer reports backpressure. The signal is re-checked around the write and the drain wait, so cancellation does not leave a pending write considered successful.

接口参考、使用示例与开发指南。