n4nAI

Topic

Server-Sent Events (SSE) Streaming Deep Dive

14 posts on server-sent events (sse) streaming deep dive — part of api integration on the n4n AI blog.

API integrationAnalysis

Why LLM APIs use SSE instead of chunked plain text

Explains why LLM APIs use SSE instead of chunked plain text, covering protocol framing, structured streaming, client ergonomics, and tradeoffs for engineers.

4 min read
API integrationDefinition

Understanding backpressure in SSE token streaming

Backpressure in SSE token streaming is flow control between LLM server and client. This explainer covers how it works, why it matters, and pitfalls for engineers.

4 min read
API integrationHow-to

Turn an SSE stream into a JavaScript async iterator

Learn how to wrap a Server-Sent Events feed in a JavaScript async iterator to consume LLM streams cleanly with for-await-of loops step by step.

4 min read
API integrationHow-to

Streaming partial tool calls over SSE in chat completions

Step-by-step guide to sse streaming partial tool calls in chat completions: parse Server-Sent Events, reconstruct tool arguments, and verify streams.

3 min read
API integrationGuide

SSE timeout and keep-alive settings for long LLM responses

Practical guide to tuning SSE timeout and keep-alive settings for long LLM responses, with client code, proxy pitfalls, and retry strategies.

4 min read
API integrationGuide

SSE buffering pitfalls behind nginx and proxies

A practical guide to avoiding sse buffering nginx proxy issues: disable proxy buffering, set correct headers, and debug stalled LLM token streams.

4 min read
API integrationHow-to

Reconnecting dropped SSE streams with Last-Event-ID

Learn how to implement SSE reconnect with Last-Event-ID to resume dropped LLM streaming connections reliably, with runnable code examples.

3 min read
API integrationHow-to

Parsing the data: field in an OpenAI SSE stream

Learn how to implement robust openai sse data field parsing for streaming LLM responses: buffer events, extract data lines, handle [DONE], and verify.

4 min read
API integrationHow-to

Handling the [DONE] marker in OpenAI streaming responses

Learn how to correctly parse the OpenAI [DONE] marker in Server-Sent Events streams, with runnable Python and TypeScript code for robust LLM integrations.

3 min read
API integrationHow-to

Debugging SSE connections with browser dev tools

Learn how to debug SSE connections dev tools in the browser: inspect live streams, replay events, and fix broken Server-Sent Events integrations step by step.

5 min read
API integrationComparison

SSE vs WebSockets for streaming chat completions

A head-to-head comparison of SSE vs WebSockets for streaming chat completions across capabilities, cost, latency, ergonomics, and limits, with a verdict.

5 min read
API integrationDefinition

How server-sent events work for LLM token streaming

Server-sent events (SSE) stream LLM tokens over HTTP. Understand how SSE works for LLM token streaming: wire format, client code, and common pitfalls.

4 min read
API integrationComparison

Comparing SSE streaming across OpenAI, Anthropic, and n4n

Head-to-head sse streaming openai anthropic n4n comparison: SSE shapes, cost, latency, ergonomics, limits, and a verdict for engineers.

4 min read
API integrationTutorial

Building a browser EventSource client for chat streaming

Learn to build an eventsource browser chat streaming client with a tiny SSE server, handling reconnection, parsing, and CORS for real chat apps.

3 min read