Skip to content

v0.5.0

Compare
Choose a tag to compare
@github-actions github-actions released this 09 Feb 19:29
· 47 commits to main since this release
v0.5.0
69425c6

Bump version 0.4.3 → 0.5.0

New features

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:
with WebSocketSession(...) as session:
    ...

async with AsyncWebSocketSession(...) as session:
    ...
  • AsyncWebSocketSession.receive_* methods may now raise TimeoutError instead of asyncio.TimeoutError:

Before

try:
    event = await ws.receive(timeout=2.)
except asyncio.TimeoutError:
    print("No event received.")
except WebSocketDisconnect:
    print("Connection closed")

After

try:
    event = await ws.receive(timeout=2.)
except TimeoutError:
    print("No event received.")
except WebSocketDisconnect:
    print("Connection closed")