Freigeben über


WebsocketConnectionOptions Class

Transport-agnostic WebSocket connection options for VoiceLive.

These control common WS behaviors (compression, message size limits, timeouts, ping/pong handling). Unless specified, defaults are determined by the underlying WebSocket library.

Constructor

WebsocketConnectionOptions()

Keyword-Only Parameters

Name Description
compression

Enable per-message compression. Use True to enable, False to disable. Advanced users may pass an int to select a zlib window value if supported by the transport.

max_msg_size

Maximum message size in bytes before the client closes the connection.

heartbeat

Interval in seconds between keep-alive pings.

autoclose

Automatically close when a close frame is received.

autoping

Automatically respond to ping frames with pong frames.

receive_timeout

Max seconds to wait for a single incoming message on an established WebSocket.

close_timeout

Max seconds to wait for a graceful close handshake.

handshake_timeout

Max seconds for connection establishment (DNS/TCP/TLS + WS upgrade). Note: with aiohttp this is applied on the ClientSession (not a ws_connect kwarg), so must be handled by the caller.

vendor_options

Optional implementation-specific options passed through as-is to the underlying library (not part of the stable API).

Methods

clear
copy
fromkeys

Create a new dictionary with keys from iterable and values set to value.

get

Return the value for key if key is in the dictionary, else default.

items
keys
pop

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values

clear

clear() -> None.  Remove all items from D.

copy

copy() -> a shallow copy of D

fromkeys

Create a new dictionary with keys from iterable and values set to value.

fromkeys(value=None, /)

Positional-Only Parameters

Name Description
iterable
Required
value
Default value: None

get

Return the value for key if key is in the dictionary, else default.

get(key, default=None, /)

Positional-Only Parameters

Name Description
key
Required
default
Default value: None

items

items() -> a set-like object providing a view on D's items

keys

keys() -> a set-like object providing a view on D's keys

pop

If the key is not found, return the default if given; otherwise, raise a KeyError.

pop(k, [d]) -> v, remove specified key and return the corresponding value.

popitem

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

popitem()

setdefault

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

setdefault(key, default=None, /)

Positional-Only Parameters

Name Description
key
Required
default
Default value: None

update

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

update([E], **F) -> None.  Update D from dict/iterable E and F.

values

values() -> an object providing a view on D's values

Attributes

autoclose

autoclose: bool

autoping

autoping: bool

close_timeout

close_timeout: float

compression

compression: bool | int

handshake_timeout

handshake_timeout: float

heartbeat

heartbeat: float

max_msg_size

max_msg_size: int

receive_timeout

receive_timeout: float

vendor_options

vendor_options: Mapping[str, Any]