File tree Expand file tree Collapse file tree 4 files changed +29
-8
lines changed
Expand file tree Collapse file tree 4 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 4.0.8] - 2025-06-20
9+
10+ - Patch WebsocketClient to work with any websockets version >= 10.0
11+
812## [ 4.0.7] - 2025-06-19
913
1014- Support requesting a temporary token (JWT) with region and client ref
Original file line number Diff line number Diff line change 1- 4.0.7
1+ 4.0.8
Original file line number Diff line number Diff line change 1- websockets >= 14 .0
1+ websockets >= 10 .0
22httpx [http2 ]~= 0.23
33polling2 ~= 0.5
44toml ~= 0.10.2
Original file line number Diff line number Diff line change 3939 UsageMode ,
4040)
4141
42+ try :
43+ # websockets >= 13.0
44+ from websockets .asyncio .client import ClientConnection
45+ from websockets .asyncio .client import connect
46+
47+ WS_HEADERS_KEY = "additional_headers"
48+ except ImportError :
49+ from websockets .legacy .client import WebSocketClientProtocol
50+ from websockets .legacy .client import connect # type: ignore
51+
52+ WS_HEADERS_KEY = "extra_headers"
53+
54+
4255LOGGER = logging .getLogger (__name__ )
4356
4457# If the logging level is set to DEBUG then websockets logs very verbosely,
@@ -613,14 +626,18 @@ async def run(
613626 parsed_url ._replace (path = url_path , query = updated_query )
614627 )
615628
629+ ws_kwargs = {
630+ WS_HEADERS_KEY : extra_headers ,
631+ "ssl" : self .connection_settings .ssl_context ,
632+ "ping_timeout" : self .connection_settings .ping_timeout_seconds ,
633+ # Don't limit the max. size of incoming messages
634+ "max_size" : None ,
635+ }
636+
616637 try :
617- async with websockets . connect ( # pylint: disable=no-member
638+ async with connect (
618639 updated_url ,
619- ssl = self .connection_settings .ssl_context ,
620- ping_timeout = self .connection_settings .ping_timeout_seconds ,
621- # Don't limit the max. size of incoming messages
622- max_size = None ,
623- additional_headers = extra_headers ,
640+ ** ws_kwargs ,
624641 ) as self .websocket :
625642 await self ._communicate (stream , audio_settings )
626643 finally :
You can’t perform that action at this time.
0 commit comments