Types - websockets 10.2 documentation

Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# Types

websockets.typing.Data

  Types supported in a WebSocket message: `str` for a Text frame, `bytes` for a Binary.

  alias of `Union`[`str`, `bytes`]

websockets.typing.LoggerLike

  Types accepted where a `Logger` is expected.

  alias of `Union`[`logging.Logger`, `logging.LoggerAdapter`]

websockets.typing.Origin

  Value of a `Origin` header.

  alias of `str`

websockets.typing.Subprotocol

  Subprotocol in a `Sec-WebSocket-Protocol` header.

  alias of `str`

websockets.typing.ExtensionName

  Name of a WebSocket extension.

  alias of `str`

websockets.typing.ExtensionParameter

  Parameter of a WebSocket extension.

  alias of `Tuple`[`str`, `Optional`[`str`]]

websockets.connection.Event

  Events that `events_received()` may return.

  alias of `Union`[`websockets.http11.Request`, `websockets.http11.Response`, `websockets.frames.Frame`]

websockets.datastructures.HeadersLike

  Types accepted where `Headers` is expected.

  alias of `Union`[`websockets.datastructures.Headers`, `Mapping`[`str`, `str`], `Iterable`[`Tuple`[`str`, `str`]]]