daphne
Django ASGI (HTTP/WebSocket) server
What it is and what it does
Daphne is an ASGI server purpose-built for Django Channels that terminates HTTP, HTTP/2, and WebSocket connections. It automatically negotiates which protocol to use based on client requests, eliminating the need for URL-based routing to distinguish WebSocket from HTTP endpoints. The server is configured via command-line flags or Twisted endpoint description strings, supporting multiple binding modes: TCP ports, UNIX sockets, file descriptors passed from process managers, and TLS endpoints.
The package depends on asgiref, autobahn, and twisted. It supports Python 3.9 through 3.13 and is actively maintained as part of the Django Channels project. HTTP/2 support is available when Twisted's http2 and tls extras are installed and TLS is enabled; the server logs whether HTTP/2 support is active on startup. Daphne is typically deployed behind a reverse proxy for static file serving or as a standalone application server in containerized environments.
Use it for:
- Running Django Channels applications that need to handle real-time WebSocket connections alongside standard HTTP requests.
- Deploying ASGI applications with HTTP/2 support when TLS is enabled and modern OpenSSL is available.
- Binding to UNIX sockets for inter-process communication with a reverse proxy or load balancer.
- Using automatic TLS certificate provisioning via txacme endpoint syntax for Let's Encrypt integration.
- Running inside process managers (systemd, supervisord) that pass file descriptors to the application.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Daphne is an ASGI server that handles HTTP, HTTP/2, and WebSocket protocols for Django Channels applications, with automatic protocol negotiation and support for multiple binding modes.
Yes. Daphne is the reference ASGI server for Django Channels with active maintenance, no known vulnerabilities, low install friction, and permissive licensing. Install it if you are building a Django Channels application or need an ASGI server with native WebSocket and HTTP/2 support. The only gotcha is the HTTP/2 requirement for OpenSSL 1.0.2+, which is standard on modern systems.
Install
daphne on PyPI
pip
pip install daphneuv
uv add daphnepoetry
poetry add daphneInstalling daphne
Before you install
Low install friction with a pure-Python wheel. Actively maintained with a recent release (24 days ago) and 2679 repository stars. Requires Python 3.9 or later; HTTP/2 support needs Twisted's http2 and tls extras plus OpenSSL 1.0.2 or greater.
License in practice
BSD license (permissive) places no significant restrictions on use, modification, or distribution.
Quickstart
pip install daphne
# Point Daphne to your ASGI application:
daphne -b 0.0.0.0 -p 8001 django_project.asgi:application
# Or use a UNIX socket:
daphne -u /tmp/daphne.sock django_project.asgi:application
Requires Python 3.9 or later. HTTP/2 support requires OpenSSL 1.0.2 or greater and Twisted[tls,http2] installed separately.
Verify before relying
- Performance characteristics and throughput capacity under load compared to other ASGI servers.
- Whether automatic protocol negotiation works reliably across all client types and edge cases.
- Production deployment best practices and recommended configurations for high-traffic scenarios.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — asgiref, autobahn, twisted |
| Maintenance | actively maintained — 24 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,048,311/month — #1,977 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: daphne-4.2.3-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
channelsChannels augments Django with WebSocket,…
permissive · top 5,000 on PyPI
uvicornUvicorn is an ASGI web server that runs async…
permissive · top 100 on PyPI
channels-redisProvides Redis-backed channel layers for Django…
permissive · top 5,000 on PyPI
asgirefProvides ASGI base libraries including…
permissive · top 1,000 on PyPI
starletteStarlette is a lightweight ASGI framework for…
permissive · top 100 on PyPI
HypercornHypercorn is an ASGI and WSGI web server…
permissive · top 5,000 on PyPI
autobahnAutobahn provides WebSocket and WAMP (Web…
permissive · top 5,000 on PyPI
django-eventstreamAdds Server-Sent Events (SSE) streaming to…
permissive · top 15,000 on PyPI
granianGranian is a Rust-based HTTP server that runs…
permissive · top 5,000 on PyPI
django-gripIntegrates Django with GRIP-compatible proxies…
permissive · top 15,000 on PyPI