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 a client that says "Hello world!":

   #!/usr/bin/env python

   import asyncio
   import websockets

   async def hello(uri):
       async with websockets.connect(uri) as websocket:
           await websocket.send("Hello world!")

   asyncio.get_event_loop().run_until_complete(
       hello('ws://localhost:8765'))

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)

   asyncio.get_event_loop().run_until_complete(
       websockets.serve(echo, 'localhost', 8765))
   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...

  * Python < 3.6


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 use

  * Port sharing


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

  * Memory use

  * Other limits


Project
=======

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

* Contributing

  * Code of Conduct

  * Contributions

  * Questions

  * Bitcoin users

* Changelog

  * 7.1

  * 7.0

  * 6.0

  * 5.0

  * 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

* License
