hypercorn.protocol.ws_stream module

class hypercorn.protocol.ws_stream.ASGIWebsocketState(value)

Bases: enum.Enum

An enumeration.

CLOSED = 4
CONNECTED = 2
HANDSHAKE = 1
HTTPCLOSED = 5
RESPONSE = 3
exception hypercorn.protocol.ws_stream.FrameTooLarge

Bases: Exception

class hypercorn.protocol.ws_stream.Handshake(headers: List[Tuple[bytes, bytes]], http_version: str)

Bases: object

accept(subprotocol: Optional[str]) → Tuple[int, List[Tuple[bytes, bytes]], wsproto.connection.Connection]
is_valid() → bool
class hypercorn.protocol.ws_stream.WSStream(app: Union[Type[hypercorn.typing.ASGI2Protocol], Callable[[dict, Callable, Callable], Awaitable[None]]], config: hypercorn.config.Config, context: hypercorn.typing.Context, ssl: bool, client: Optional[Tuple[str, int]], server: Optional[Tuple[str, int]], send: Callable[[hypercorn.protocol.events.Event], Awaitable[None]], stream_id: int)

Bases: object

async app_send(message: Optional[dict]) → None
async handle(event: hypercorn.protocol.events.Event) → None
property idle
class hypercorn.protocol.ws_stream.WebsocketBuffer(max_length: int)

Bases: object

clear() → None
extend(event: wsproto.events.Message) → None
to_message() → dict