websockets
**********

[image: pypi-v][image] [image: pypi-pyversions][image] [image:
pypi-l][image] [image: pypi-wheel][image] [image: circleci][image]
[image: codecov][image]

"websockets" is a library for building WebSocket servers and clients
in Python with a focus on correctness and simplicity.

Built on top of "asyncio", Python's standard asynchronous I/O
framework, it provides an elegant coroutine-based API.

Here's how a client sends and receives messages:

   #!/usr/bin/env python

   import asyncio
   import websockets

   async def hello():
       uri = "ws://localhost:8765"
       async with websockets.connect(uri) as websocket:
           await websocket.send("Hello world!")
           await websocket.recv()

   asyncio.get_event_loop().run_until_complete(hello())

And here's an echo server:

   #!/usr/bin/env python

   import asyncio
   import websockets

   async def echo(websocket, path):
       async for message in websocket:
           await websocket.send(message)

   start_server = websockets.serve(echo, "localhost", 8765)

   asyncio.get_event_loop().run_until_complete(start_server)
   asyncio.get_event_loop().run_forever()

Do you like it? Let's dive in!


Tutorials
=========

If you're new to "websockets", this is the place to start.

* Getting started

  * Requirements

  * Installation

  * Basic example

  * Secure example

  * Browser-based example

  * Synchronization example

  * Common patterns

  * That's all!

  * One more thing...

* FAQ

  * Server side

  * Client side

  * Both sides

  * Miscellaneous


How-to guides
=============

These guides will help you build and deploy a "websockets"
application.

* Cheat sheet

  * Server

  * Client

  * Debugging

  * Passing additional arguments to the connection handler

* Deployment

  * Application server

  * Graceful shutdown

  * Memory usage

  * Port sharing

* Extensions

  * Per-Message Deflate

  * Writing an extension


Reference
=========

Find all the details you could ask for, and then some.

* API

  * Design

  * High-level

  * Low-level


Discussions
===========

Get a deeper understanding of how "websockets" is built and why.

* Design

  * Lifecycle

  * Opening handshake

  * Data transfer

  * Connection termination

  * Connection failure

  * Server shutdown

  * Cancellation

  * Backpressure

  * Buffers

  * Concurrency

* Limitations

* Security

  * Encryption

  * Memory use

  * Other limits


Project
=======

This is about websockets-the-project rather than websockets-the-
software.

* Changelog

  * 8.2

  * 8.1

  * 8.0.2

  * 8.0.1

  * 8.0

  * 7.0

  * 6.0

  * 5.0.1

  * 5.0

  * 4.0.1

  * 4.0

  * 3.4

  * 3.3

  * 3.2

  * 3.1

  * 3.0

  * 2.7

  * 2.6

  * 2.5

  * 2.4

  * 2.3

  * 2.2

  * 2.1

  * 2.0

  * 1.0

* Contributing

  * Code of Conduct

  * Contributions

  * Questions

  * Bitcoin users

* License

* For enterprise

  * Available as part of the Tidelift Subscription

  * Enterprise-ready open source software—managed for you
