← All Learning Paths

SSE Streaming Developer

Stream updates over plain HTTP: server-sent events versus WebSockets, chunked encoding, backpressure, and the proxies that truncate streams silently.

roleintermediate8 nodes14.58h total

Path overview

单向推送场景下,SSE 以更低的复杂度换走 WebSocket 的大部分收益。本路径从技术选型与分块编码讲起,覆盖浏览器端订阅与背压、服务端流式响应,最终直面代理截断与流生命周期错误,收尾于 Next.js 流式 SSR 案例。

For one-way pushes, SSE buys most of WebSocket value at far lower complexity. This path covers selection criteria, chunked encoding, browser subscription with backpressure, proxy truncation, and a streaming SSR case.

  1. Read "How to Choose Between SSE and WebSockets" for the "Transport and framing differences" argument, then name the decision in sse work it would change.

    Completion criteria: Attach a decision log for "How to Choose Between SSE and WebSockets": the "Transport and framing differences" section, one rejected alternative, and the diff of the file you changed.

    Next step: How to Implement Server-Sent Events in Node.js

    ⏱ 1h

  2. Compare "The SSE wire format" with "Stream from the server" in "How to Implement Server-Sent Events in Node.js" and state which trade-off you would accept in sse code.

    Prerequisites: How to Choose Between SSE and WebSockets

    Completion criteria: Record a short walkthrough of "How to Implement Server-Sent Events in Node.js" with timestamps at "The SSE wire format" and "Stream from the server", plus the commit that applies it.

    Next step: SSE Typed Event Stream Subscription

    ⏱ 1h

  3. Execute "SSE Typed Event Stream Subscription", change one constant, and describe how the output diverges from "Subscribe to a typed server-sent event stream with EventSource listeners per event type,".

    Prerequisites: How to Implement Server-Sent Events in Node.js

    Completion criteria: Paste the command, the exit code, and the output line matching "Subscribe to a typed server-sent event stream with EventSource listeners per event type,"; then show a second run with a changed parameter.

    Next step: Fetch Streaming Response Backpressure

    ⏱ 0.75h

  4. Run the sse snippet "Fetch Streaming Response Backpressure", capture stdout, and show which line demonstrates the documented behavior: "Read a fetch response body as a stream with manual reader control, honoring backpressure so".

    Prerequisites: SSE Typed Event Stream Subscription

    Completion criteria: Save two runs of "Fetch Streaming Response Backpressure" side by side — the original input and one changed value — and annotate the line where the output diverges.

    Next step: Axum Streaming Response Body

    ⏱ 0.75h

  5. Adapt "Axum Streaming Response Body" to a second input and compare the new output with the behavior described in "Stream large responses from an async generator into the response body, applying timeouts per".

    Prerequisites: Fetch Streaming Response Backpressure

    Completion criteria: Attach the terminal transcript for "Axum Streaming Response Body": command, exit code, and the printed result you used to confirm "Stream large responses from an async generator into the response body, applying timeouts per".

    Next step: Next.js App Router Streaming SSR

    ⏱ 0.75h

  6. Compare "Next.js App Router Streaming SSR"'s Next.js, React, TypeScript, Vercel design with your sse stack and list the trade-off "React Suspense streaming with per-component loading states for progressive rendering" implies.

    Completion criteria: List each Next.js, React, TypeScript, Vercel component of "Next.js App Router Streaming SSR", its responsibility, and one trade-off, citing "React Suspense streaming with per-component loading states for progressive rendering".

    Next step: Encode Server-Sent Events Correctly

    ⏱ 1.5h

  7. In the "SSE Streaming Developer" path, implement "Encode Server-Sent Events Correctly" so JSON object: { events: [{ id, event, data }] } yields id: 1\nevent: tick\ndata: ok\n\n, including the second sample's edge case.

    Prerequisites: Next.js App Router Streaming SSR

    Completion criteria: Attach the solution file for "SSE Streaming Developer", two passing sample runs, and one failing run whose error matches the contract.

    Next step: Capstone: SSE Streaming Developer

    ⏱ 0.33h

  8. Ship "Setup stream" from "Build a Server-Sent Events Broadcast Service", then prove it with the project's test suite and an acceptance note.

    Prerequisites: Next.js App Router Streaming SSR, Encode Server-Sent Events Correctly

    Completion criteria: Deliver "Setup stream" and paste the test output where the acceptance test passes; include the test name and command.

    Next step: Run the capstone's tests, publish the repository, and demo it to a reviewer.

    ⏱ 4h