Skip to content

Commit 2d79705

Browse files
committed
fix(gql.transport.websockets): update type to permit passing floats
1 parent 87a56ce commit 2d79705

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

gql/transport/websockets.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,10 @@ def __init__(
9292
headers: Optional[HeadersLike] = None,
9393
ssl: Union[SSLContext, bool] = False,
9494
init_payload: Dict[str, Any] = {},
95-
connect_timeout: int = 10,
96-
close_timeout: int = 10,
97-
ack_timeout: int = 10,
98-
keep_alive_timeout: Optional[int] = None,
95+
connect_timeout: Optional[Union[int, float]] = 10,
96+
close_timeout: Optional[Union[int, float]] = 10,
97+
ack_timeout: Optional[Union[int, float]] = 10,
98+
keep_alive_timeout: Optional[Union[int, float]] = None,
9999
connect_args: Dict[str, Any] = {},
100100
) -> None:
101101
"""Initialize the transport with the given parameters.
@@ -105,10 +105,11 @@ def __init__(
105105
:param ssl: ssl_context of the connection. Use ssl=False to disable encryption
106106
:param init_payload: Dict of the payload sent in the connection_init message.
107107
:param connect_timeout: Timeout in seconds for the establishment
108-
of the websocket connection.
109-
:param close_timeout: Timeout in seconds for the close.
108+
of the websocket connection. If None is provided this will wait forever.
109+
:param close_timeout: Timeout in seconds for the close. If None is provided
110+
this will wait forever.
110111
:param ack_timeout: Timeout in seconds to wait for the connection_ack message
111-
from the server.
112+
from the server. If None is provided this will wait forever.
112113
:param keep_alive_timeout: Optional Timeout in seconds to receive
113114
a sign of liveness from the server.
114115
:param connect_args: Other parameters forwarded to websockets.connect
@@ -118,9 +119,9 @@ def __init__(
118119
self.headers: Optional[HeadersLike] = headers
119120
self.init_payload: Dict[str, Any] = init_payload
120121

121-
self.connect_timeout: int = connect_timeout
122-
self.close_timeout: int = close_timeout
123-
self.ack_timeout: int = ack_timeout
122+
self.connect_timeout: Optional[Union[int, float]] = connect_timeout
123+
self.close_timeout: Optional[Union[int, float]] = close_timeout
124+
self.ack_timeout: Optional[Union[int, float]] = ack_timeout
124125
self.keep_alive_timeout: Optional[int] = keep_alive_timeout
125126

126127
self.connect_args = connect_args

0 commit comments

Comments
 (0)