https://github.com/fuyukai/stickney
I hate epoll! I hate epoll!
https://github.com/fuyukai/stickney
anyio python trio websocket
Last synced: over 1 year ago
JSON representation
I hate epoll! I hate epoll!
- Host: GitHub
- URL: https://github.com/fuyukai/stickney
- Owner: Fuyukai
- License: lgpl-3.0
- Created: 2023-11-02T17:38:17.000Z (over 2 years ago)
- Default Branch: mizuki
- Last Pushed: 2023-12-10T06:42:09.000Z (over 2 years ago)
- Last Synced: 2025-01-25T03:39:53.930Z (over 1 year ago)
- Topics: anyio, python, trio, websocket
- Language: Python
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
Stickney
========
.. image:: https://img.shields.io/pypi/v/stickney
:alt: PyPI - Version
:target: https://pypi.org/project/stickney/
Stickney is an asynchronous websockets library for `AnyIO`_ and Python 3.11+. This is primarily
designed for Trio (as asyncio is a bastard evil terrible library that deadlocks constantly) usage.
Installation
------------
Stickney is available on PyPI.
.. code-block:: fish
$ poetry add stickney@latest
Usage
-----
Create a new websocket with the ``open_ws_connection`` function:
.. code-block:: python
async with open_ws_connection(url="wss://example.websocket.server/path?a=b") as ws:
...
You can send messages with the ``send_message`` function and receive messages with the
``receive_single_message`` function. You can also use ``close``, but the WS is closed automatically
when the context manager exits.
There's not really much else to it. See ``stickney/frames.py`` for the available message types.
Naming
------
Stickney is named after the `Stickney crater`_ on Phobos.
.. _AnyIO: https://anyio.readthedocs.io/en/stable/
.. _Stickney crater: https://en.wikipedia.org/wiki/Stickney_(crater)