New features
------------
* `asyncio` and [Trio](https://trio.readthedocs.io/) support through [AnyIO](https://anyio.readthedocs.io/)
Breaking changes
----------------
* `WebSocketSession` and `AsyncWebSocketSession` are now context managers. If you were using them directly instead of relying on `connect_ws` and `aconnect_ws`, you'll have to adapt your code accordingly:
py
with WebSocketSession(...) as session:
...
async with AsyncWebSocketSession(...) as session:
...
* `AsyncWebSocketSession.receive_*` methods may now raise `TimeoutError` instead of `asyncio.TimeoutError`:
**Before**
py
try:
event = await ws.receive(timeout=2.)
except asyncio.TimeoutError:
print("No event received.")
except WebSocketDisconnect:
print("Connection closed")
**After**
py
try:
event = await ws.receive(timeout=2.)
except TimeoutError:
print("No event received.")
except WebSocketDisconnect:
print("Connection closed")