aiohttp-sse
Server-sent events support for aiohttp.
What it is and what it does
aiohttp-sse wraps the EventSource protocol (server-sent events) for use in aiohttp web applications. It provides a context manager that lets you send data to a client over a persistent HTTP connection without closing it, enabling real-time push notifications and live data streams. The package handles the text/event-stream content type and connection lifecycle, so you focus on generating and sending data.
The typical workflow is to define an aiohttp route handler, use sse_response to open a streaming connection, then loop sending data while checking is_connected(). The client side uses the browser's native EventSource API to receive messages. It's a thin, focused layer on top of aiohttp for one specific use case: pushing events from server to client.
Use it for:
- Real-time dashboards or monitoring interfaces that display live server metrics or status updates.
- Live notifications or alerts pushed to web clients without polling.
- Streaming log output or progress updates from long-running server tasks to a web UI.
- Chat or collaboration features where the server broadcasts events to multiple connected clients.
- Stock tickers, sports scores, or other live data feeds delivered to web browsers.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides server-sent events (EventSource) support for aiohttp applications, allowing servers to push data to connected clients over HTTP without closing the connection.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and a permissive license. It solves a specific, well-defined problem (server-sent events in aiohttp) with a clean API. Use it when you need to push data from an aiohttp server to browser clients over HTTP.
Install
aiohttp-sse on PyPI
pip
pip install aiohttp-sseuv
uv add aiohttp-ssepoetry
poetry add aiohttp-sseInstalling aiohttp-sse
Before you install
Low friction installation with a single dependency on aiohttp. Actively maintained with recent commits and a stable release history since 2017. Supports current Python versions (3.8–3.12).
License in practice
Licensed under Apache 2 (permissive), allowing use in commercial and private projects with minimal restrictions.
Quickstart
pip install aiohttp-sse
from aiohttp import web
from aiohttp_sse import sse_response
async def stream_handler(request):
async with sse_response(request) as resp:
while resp.is_connected():
await resp.send(data)
return resp
Requires aiohttp 3+ and Python 3.8 or later.
Verify before relying
- Whether the package handles reconnection and backpressure automatically or if the caller must manage these.
- Performance characteristics under high client counts or message throughput.
- Support for custom event types beyond the default 'message' event.
Package facts
| License | Apache 2 (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — aiohttp |
| Maintenance | actively maintained — 897 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 585,145/month — #5,886 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aiohttp_sse-2.2.0-py3-none-any.whl
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
aiohttp-sse-clientProvides an async Python client for consuming…
permissive · top 15,000 on PyPI
aiohttp-sse-client2Provides an async Python client for consuming…
permissive · top 15,000 on PyPI
httpx-sseConsume Server-Sent Event (SSE) messages from…
permissive · top 1,000 on PyPI
sse-starletteProvides Server-Sent Events streaming for…
permissive · top 1,000 on PyPI
requests-sseProvides a Python client for consuming…
permissive · top 15,000 on PyPI
launchdarkly-eventsourceConsumes Server-Sent Events (SSE) from remote…
permissive · top 5,000 on PyPI
django-eventstreamAdds Server-Sent Events (SSE) streaming to…
permissive · top 15,000 on PyPI
sseclientIterates over Server Sent Event (SSE) streams…
permissive · top 15,000 on PyPI
filigran-sseclientProvides a Python iterator interface for…
permissive · top 5,000 on PyPI
aiohttp-xmlrpcProvides async XML-RPC server and client…
permissive · top 15,000 on PyPI