A websocket library for curio + trio
Project description
asyncwebsockets
=======
asyncwebsockets is a `curio`_ + `trio`_ compatible library for connecting and serving websockets.
Installation
------------
To install the latest stable version::
$ pip install asyncwebsockets
To install the latest development version::
$ pip install git+https://github.com/SunDwarf/asyncwebsockets.git#egg=asyncwebsockets
Basic Usage
-----------
.. code-block:: python3
import multio
from asyncwebsockets.client import connect_websocket
from asyncwebsockets.ws import WebsocketConnectionEstablished, WebsocketBytesMessage
async def test():
sock = await connect_websocket("wss://echo.websocket.org", reconnecting=False)
async for message in sock:
print("Event received", message)
if isinstance(message, WebsocketConnectionEstablished):
await sock.send_message(b"test")
elif isinstance(message, WebsocketBytesMessage):
print("Got response:", message.data)
await sock.close(code=1000, reason="Thank you!")
multio.init("curio")
multio.run(main)
.. _curio: https://curio.readthedocs.io/en/latest/
.. _trio: https://trio.readthedocs.io/en/latest/
=======
asyncwebsockets is a `curio`_ + `trio`_ compatible library for connecting and serving websockets.
Installation
------------
To install the latest stable version::
$ pip install asyncwebsockets
To install the latest development version::
$ pip install git+https://github.com/SunDwarf/asyncwebsockets.git#egg=asyncwebsockets
Basic Usage
-----------
.. code-block:: python3
import multio
from asyncwebsockets.client import connect_websocket
from asyncwebsockets.ws import WebsocketConnectionEstablished, WebsocketBytesMessage
async def test():
sock = await connect_websocket("wss://echo.websocket.org", reconnecting=False)
async for message in sock:
print("Event received", message)
if isinstance(message, WebsocketConnectionEstablished):
await sock.send_message(b"test")
elif isinstance(message, WebsocketBytesMessage):
print("Got response:", message.data)
await sock.close(code=1000, reason="Thank you!")
multio.init("curio")
multio.run(main)
.. _curio: https://curio.readthedocs.io/en/latest/
.. _trio: https://trio.readthedocs.io/en/latest/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
asyncwebsockets-0.2.0.tar.gz
(9.2 kB
view details)
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
asyncwebsockets-0.2.0-py3.6.egg
(13.1 kB
view details)
File details
Details for the file asyncwebsockets-0.2.0.tar.gz.
File metadata
- Download URL: asyncwebsockets-0.2.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bfec3ceb15fd8f53e66b1c9bb95b6cb4ebb838513a1f6e5ad114002549a449b9
|
|
| MD5 |
72db5bc8a50aff2cf5e3912bab7cfbee
|
|
| BLAKE2b-256 |
62bc8b71e69e777fabaa8c45052dce647a1c7b81ba209faaf620f54fda7bb882
|
File details
Details for the file asyncwebsockets-0.2.0-py3.6.egg.
File metadata
- Download URL: asyncwebsockets-0.2.0-py3.6.egg
- Upload date:
- Size: 13.1 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
101b078504a9ae6a85f4a4ff0c5d65498899889dba7518e20406c66afcab18bc
|
|
| MD5 |
31266a4140519f7527b322567d29a6df
|
|
| BLAKE2b-256 |
d6fee203ebe0e50a352fffe09e5eedcd526511a36002b088fdcba1441bba23bb
|
File details
Details for the file asyncwebsockets-0.2.0-py3-none-any.whl.
File metadata
- Download URL: asyncwebsockets-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72a32729ed01a4504fca19fa35155de37a8e69a8e2a71a2d9ba2362213937b03
|
|
| MD5 |
8a0088d2979430ce453cfbf22050d7bb
|
|
| BLAKE2b-256 |
4704e5bdfe8c45b3184d25fd87581361a8879d39c1c53e85a7aac8d16f34578f
|