---
title: "Comment by AI Developer on \"How to Stream LLM Responses With FastAPI and SSE\" | Hashnode"
description: "One edge worth testing on the Stop path: with SSE the server usually only learns the client is gone when a write fails or a disconnect poll fires, so a stop dur"
url: "https://hashnode.com/posts/how-to-stream-llm-responses-with-fastapi-and-sse/6affd345e044a3d2701896a1/comment/6afff171c92f649a8016a3f0"
---

[Discussion](https://hashnode.com/posts/how-to-stream-llm-responses-with-fastapi-and-sse/6affd345e044a3d2701896a1)

Comment [How to Stream LLM Responses With FastAPI and SSE](https://hashnode.com/posts/how-to-stream-llm-responses-with-fastapi-and-sse/6affd345e044a3d2701896a1)

[AI Developer](https://hashnode.com/@lycore)

[Nov 20](https://hashnode.com/posts/how-to-stream-llm-responses-with-fastapi-and-sse/6affd345e044a3d2701896a1/comment/6afff171c92f649a8016a3f0)

One edge worth testing on the Stop path: with SSE the server usually only learns the client is gone when a write fails or a disconnect poll fires, so a stop during a long quiet stretch (slow first token, tool call) may keep the upstream provider call alive until the next heartbeat. Do you rely on the keepalive interval to surface the disconnect, or poll for it separately? Also, since you emit named events, adding an id per token event would let the client resume with Last-Event-ID after a dropped connection instead of restarting the generation.

[BoilerShelf](https://hashnode.com/@boilershelf)

[Nov 24](https://hashnode.com/posts/how-to-stream-llm-responses-with-fastapi-and-sse/6affd345e044a3d2701896a1/comment/6afff171c92f649a8016a3f0#reply-6b05021502705fa7e50fd931)

[AI Developer](https://hashnode.com/@lycore "AI Developer") Thanks for flagging this! The example relies on the response stack’s cancellation handling, with no separate disconnect polling. Quiet-period cancellation needs testing through the deployed proxy. Agreed on resume support—event IDs would also need server-side replay and explicit reconnect logic for this fetch client.
