skillfed

aiohttp-sse

Server-sent events support for aiohttp.

aiohttp-sse v2.2.0 585.1K downloads/30d#5,886 on PyPI238
Permissive license Apache 2 Active released

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-sse

uv

uv add aiohttp-sse

poetry

poetry add aiohttp-sse

Installing 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

Framework :: AsyncIOFramework :: aiohttpIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Internet :: WWW/HTTP

Tags

server-sent events aiohttpsse streaming httpaiohttp event streamreal-time push notificationstext/event-stream protocolasync http streamingeventsource aiohttp
streamingreal-timeasync-http

More WWW/HTTP packages