sse-starlette
SSE plugin for Starlette
Decision gist · record as of 2026-08-14
Yes. sse-starlette is production-stable (Development Status 5), actively maintained, has no known vulnerabilities, and solves a well-defined problem with minimal dependencies. Install it if you need to add real-time event streaming to a Starlette or FastAPI application and want standards-compliant SSE without building the plumbing yourself.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.10 or later; must be used within a Starlette or FastAPI application.
- Low friction install with only two runtime dependencies (starlette and anyio).
- Actively maintained with a recent release (9 days old) and 846 repository stars.
License · maintenance · safety
BSD-3-Clause (permissive) — BSD-3-Clause is permissive; you can use this in commercial and proprietary projects with minimal restrictions, provided you include the license notice.
last release 2026-08-05 (9 days) · last repo commit 2026-08-05 · 846 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 306,536,742 downloads/mo, #135 on PyPI
Alternatives
Verify before relying
pip install sse-starlette
from starlette.applications import Starlette
from starlette.routing import Route
from sse_starlette import EventSourceResponse
import asyncio
async def generate_events():
for i in range(10):
yield {"data": f"Event {i}"}
await asyncio.sleep(1)
async def sse_endpoint(request):
return EventSourceResponse(generate_events())
app = Starlette(routes=[Route("/events", sse_endpoint)])- Whether the package handles backpressure and flow control for slow clients.
- Performance characteristics under high client concurrency or large event volumes.
- Behavior and recovery options when network errors occur mid-stream.
What it is and what it does
sse-starlette is a production-ready Server-Sent Events implementation for Starlette and FastAPI that lets you stream data from the server to connected clients in real time. It wraps the W3C SSE specification into a simple async interface: you provide an async generator or memory channel, and the library handles formatting, framing, client disconnect detection, and graceful shutdown. The core abstraction is EventSourceResponse, which you return from a route handler; it manages the streaming lifecycle, including automatic ping messages to keep connections alive and cooperative shutdown with configurable grace periods so your generator can send farewell events before the server terminates.
The package depends only on starlette and anyio, making it lightweight and easy to integrate into existing Starlette or FastAPI projects. It supports modern Python async patterns, works correctly in multi-threaded applications and with multiple asyncio event loops, and provides structured event classes (ServerSentEvent, JSONServerSentEvent) for common patterns. Configuration options include ping intervals, send timeouts, custom headers, and shutdown behavior, giving you fine-grained control over streaming semantics.
Use it for
- Real-time dashboard updates: stream live metrics or status changes to browser clients without polling.
- Live notifications: push alerts, messages, or events to connected users as they occur.
- Database result streaming: yield rows from a database query one at a time to the client.
- Progress tracking: stream completion percentage or status updates for long-running server tasks.
- Chat or collaborative editing: broadcast messages or document changes to multiple connected clients.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
sse-starlette is production-stable (Development Status 5), actively maintained, has no known vulnerabilities, and solves a well-defined problem with minimal dependencies. Install it if you need to add real-time event streaming to a Starlette or FastAPI application and want standards-compliant SSE without building the plumbing yourself.
Install
sse-starlette on PyPI
Before you install
Low friction install with only two runtime dependencies (starlette and anyio). Actively maintained with a recent release (9 days old) and 846 repository stars. Supports current Python versions (3.10–3.13).
Requires Python 3.10 or later; must be used within a Starlette or FastAPI application.
License in practice
BSD-3-Clause is permissive; you can use this in commercial and proprietary projects with minimal restrictions, provided you include the license notice.
Quickstart
pip install sse-starlette
from starlette.applications import Starlette
from starlette.routing import Route
from sse_starlette import EventSourceResponse
import asyncio
async def generate_events():
for i in range(10):
yield {"data": f"Event {i}"}
await asyncio.sleep(1)
async def sse_endpoint(request):
return EventSourceResponse(generate_events())
app = Starlette(routes=[Route("/events", sse_endpoint)])
Verify before relying
- Whether the package handles backpressure and flow control for slow clients.
- Performance characteristics under high client concurrency or large event volumes.
- Behavior and recovery options when network errors occur mid-stream.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.10 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesstarletteanyio |
| Maintenance | Actively maintained 9 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 306,536,742 / month, #135 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Topic :: Internet :: WWW/HTTP |
Evidence: sse_starlette-3.4.8-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “server-sent events starlette”
- sse-starletteProvides Server-Sent Events streaming for Starlette and FastAPI…
- assistant-streamProvides server-side streaming support for AI chat applications built…
- starlette-compressMiddleware for Starlette and FastAPI that compresses HTTP responses…
Give your agent the search over MCP, or paste the wish link into any chat.
More WWW/HTTP packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
h11 is a pure-Python HTTP/1.1 protocol implementation that handles parsing and serializing HTTP messages without any built-in I/O, letting you integrate it with any network layer you choose.
HTTPX is a fully featured HTTP client library for Python that provides both sync and async APIs, with support for HTTP/1.1 and HTTP/2, plus an integrated command-line client.
Install it if you are building new projects or modernizing existing ones that rely on HTTP.
A minimal low-level HTTP client library that sends HTTP requests with thread-safe and task-safe connection pooling, supporting HTTP/1.1, HTTP/2, proxies, and both sync and async interfaces.
aiohttp is an async HTTP client and server framework built on asyncio, supporting both WebSockets and middleware-based routing for building concurrent web applications.
Install it if you need async HTTP client or server capabilities in asyncio-based applications.
See also aiohttp-sse-client · assistant-stream · datastar-py · aiohttp-sse-client2 · httpx-sse · launchdarkly-eventsource · requests-sse · aiohttp-sse · django-eventstream · starlette