aaugustin

websockets: Build WebSocket Servers and Clients in Python

websockets is a Python library for WebSocket servers and clients, built on asyncio with additional threading, Trio, and Sans-I/O implementations. It focuses on protocol correctness, straightforward message handling, robustness, and performance.

ActivePythonBSD-3-ClauseLibraryNetworkingReal Time
Stars
5.7k
Forks
621
Stars, last 30 days
+12
Last commit
today
Contributors
83

Our take

Activeregular commits and releases

Health score

58/100

How it is scored
Activity
72
Community
49
Issues
62
Pull requests
50

+12 stars in the last 30 days

This is an actively maintained, focused Python WebSocket library with multiple concurrency APIs, though project activity is concentrated among a small share of contributors.

Good fit if

  • You need WebSocket clients or servers in Python and prefer asyncio, threading, Trio, or Sans-I/O integration.
  • Your application needs protocol-focused WebSocket handling rather than a combined HTTP framework.
  • Python 3.11 or later and the BSD-3-Clause license fit your project.

Look elsewhere if

  • You need a callback-based API, which the project explicitly does not target.
  • You need a full HTTP and WebSocket server from one library, since its HTTP support is minimal.
  • You require project ownership to be broadly distributed, as most code contributions come from one person.
All health signals
Last commit2026-10-14 (today)
Commits, last 90 days100+
Releases, last 12 months7 (latest 17.2, 2026-10-03)
Contributors83 (top contributor: 91% of commits)
Issues closed, last 90 days18 (typically closed in 6 days)
Pull requests merged, last 90 days24 (typically merged in 1 day)
Project age13 years

Checked on 2026-10-15 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

5,745

Forks

619

Change since Nov 16, 2026: -1 stars·0 forks

Overview

websockets is a Python library for building WebSocket servers and clients, built on Python's standard asyncio framework. It provides a coroutine-based API for sending and receiving messages, plus implementations using threading and Trio and a Sans-I/O layer for integrating the protocol into other projects.

It is aimed at applications that need WebSocket connections without implementing connection management themselves. The project focuses on the WebSocket protocol rather than general HTTP serving, so it can support a WebSocket endpoint but is not a complete mixed HTTP and WebSocket server framework.

Key Features

  • Async server and client APIs based on asyncio.
  • Synchronous client and server APIs based on threading.
  • Trio implementation and a Sans-I/O layer for third-party integrations.
  • WebSocket protocol support focused on RFC 6455 and compression extensions in RFC 7692.
  • Configurable memory use and backpressure handling for production connections.
  • Optional C extension to accelerate expensive operations.
  • Documentation, tests, and continuous integration are maintained as part of the project.

Use Cases

  • Python backend developers building an asynchronous WebSocket server for live application messages.
  • Teams writing WebSocket clients that need either coroutine-based or synchronous code.
  • Framework and library authors integrating WebSocket protocol handling through the Sans-I/O layer.
  • Operators building real-time services where managing message flow and backpressure matters.

What you need

Detected in the repository

  • Python >=3.11 (from pyproject.toml)
  • A test suite and automated checks on GitHub Actions

License in plain words

BSD-3-Clausepermissive

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the copyright and license notice; the authors' names cannot endorse your product
  • Share your changes: no

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

See the documentation for installation and the tutorial. The repository README includes short asyncio server and threading client examples.

Alternatives

  • autobahn-python: Autobahn also provides WebSocket clients and servers, with added WAMP RPC and publish-subscribe support and Twisted compatibility.
ProjectLanguageLicenseStarsStatus
websocketsPythonBSD-3-Clause5.7kActive
autobahn-pythonPython–2.5kActive

Considerations

The project is active, with recent commits and releases, and its issue and pull request handling is measured in days. However, contributions are highly concentrated in one person, which teams should consider when assessing continuity and maintenance risk. The library requires Python 3.11 or later. Its scope is deliberately limited: HTTP support is only enough for a health check, and it does not provide a callback-based API. The BSD-3-Clause license is permissive, but projects adopting it should still review and comply with its license terms.

Found this useful?

Share it with someone who would like websockets.

Comparisons