27
27
)
28
28
29
29
try :
30
- from websockets . client import ( # type: ignore[import-not-found,unused-ignore]
31
- WebSocketClientProtocol ,
30
+ from websockets import ( # type: ignore[import-not-found,unused-ignore]
31
+ ClientConnection ,
32
32
)
33
- from websockets . client import (
33
+ from websockets import (
34
34
connect as ws_connect ,
35
35
)
36
36
from websockets .typing import ( # type: ignore[import-not-found,unused-ignore]
@@ -46,7 +46,7 @@ async def ws_connect(*args, **kwargs):
46
46
raise NotImplementedError ("Subscriptions require 'websockets' package." )
47
47
yield
48
48
49
- WebSocketClientProtocol = Any # type: ignore[misc,assignment,unused-ignore]
49
+ ClientConnection = Any # type: ignore[misc,assignment,unused-ignore]
50
50
Data = Any # type: ignore[misc,assignment,unused-ignore]
51
51
Origin = Any # type: ignore[misc,assignment,unused-ignore]
52
52
@@ -394,7 +394,7 @@ async def _execute_ws(
394
394
if data :
395
395
yield data
396
396
397
- async def _send_connection_init (self , websocket : WebSocketClientProtocol ) -> None :
397
+ async def _send_connection_init (self , websocket : ClientConnection ) -> None :
398
398
payload : Dict [str , Any ] = {
399
399
"type" : GraphQLTransportWSMessageType .CONNECTION_INIT .value
400
400
}
@@ -404,7 +404,7 @@ async def _send_connection_init(self, websocket: WebSocketClientProtocol) -> Non
404
404
405
405
async def _send_subscribe (
406
406
self ,
407
- websocket : WebSocketClientProtocol ,
407
+ websocket : ClientConnection ,
408
408
operation_id : str ,
409
409
query : str ,
410
410
operation_name : Optional [str ] = None ,
@@ -424,7 +424,7 @@ async def _send_subscribe(
424
424
async def _handle_ws_message (
425
425
self ,
426
426
message : Data ,
427
- websocket : WebSocketClientProtocol ,
427
+ websocket : ClientConnection ,
428
428
expected_type : Optional [GraphQLTransportWSMessageType ] = None ,
429
429
) -> Optional [Dict [str , Any ]]:
430
430
try :
@@ -603,7 +603,7 @@ async def _execute_ws_with_telemetry(
603
603
yield data
604
604
605
605
async def _send_connection_init_with_telemetry (
606
- self , root_span : Span , websocket : WebSocketClientProtocol
606
+ self , root_span : Span , websocket : ClientConnection
607
607
) -> None :
608
608
with self .tracer .start_as_current_span ( # type: ignore
609
609
"connection init" , context = set_span_in_context (root_span )
@@ -622,7 +622,7 @@ async def _send_connection_init_with_telemetry(
622
622
async def _send_subscribe_with_telemetry (
623
623
self ,
624
624
root_span : Span ,
625
- websocket : WebSocketClientProtocol ,
625
+ websocket : ClientConnection ,
626
626
operation_id : str ,
627
627
query : str ,
628
628
operation_name : Optional [str ] = None ,
@@ -654,7 +654,7 @@ async def _handle_ws_message_with_telemetry(
654
654
self ,
655
655
root_span : Span ,
656
656
message : Data ,
657
- websocket : WebSocketClientProtocol ,
657
+ websocket : ClientConnection ,
658
658
expected_type : Optional [GraphQLTransportWSMessageType ] = None ,
659
659
) -> Optional [Dict [str , Any ]]:
660
660
with self .tracer .start_as_current_span ( # type: ignore
0 commit comments