v0.5.0
Bump version 0.4.3 → 0.5.0
New features
Breaking changes
WebSocketSession
andAsyncWebSocketSession
are now context managers. If you were using them directly instead of relying onconnect_ws
andaconnect_ws
, you'll have to adapt your code accordingly:
with WebSocketSession(...) as session:
...
async with AsyncWebSocketSession(...) as session:
...
AsyncWebSocketSession.receive_*
methods may now raiseTimeoutError
instead ofasyncio.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")