main
1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
3from __future__ import annotations
4
5from typing import TYPE_CHECKING
6from typing_extensions import Sequence, TypedDict
7
8if TYPE_CHECKING:
9 from websockets import Subprotocol
10 from websockets.extensions import ClientExtensionFactory
11
12
13class WebsocketConnectionOptions(TypedDict, total=False):
14 """Websocket connection options copied from `websockets`.
15
16 For example: https://websockets.readthedocs.io/en/stable/reference/asyncio/client.html#websockets.asyncio.client.connect
17 """
18
19 extensions: Sequence[ClientExtensionFactory] | None
20 """List of supported extensions, in order in which they should be negotiated and run."""
21
22 subprotocols: Sequence[Subprotocol] | None
23 """List of supported subprotocols, in order of decreasing preference."""
24
25 compression: str | None
26 """The “permessage-deflate” extension is enabled by default. Set compression to None to disable it. See the [compression guide](https://websockets.readthedocs.io/en/stable/topics/compression.html) for details."""
27
28 # limits
29 max_size: int | None
30 """Maximum size of incoming messages in bytes. None disables the limit."""
31
32 max_queue: int | None | tuple[int | None, int | None]
33 """High-water mark of the buffer where frames are received. It defaults to 16 frames. The low-water mark defaults to max_queue // 4. You may pass a (high, low) tuple to set the high-water and low-water marks. If you want to disable flow control entirely, you may set it to None, although that’s a bad idea."""
34
35 write_limit: int | tuple[int, int | None]
36 """High-water mark of write buffer in bytes. It is passed to set_write_buffer_limits(). It defaults to 32 KiB. You may pass a (high, low) tuple to set the high-water and low-water marks."""