from types import TracebackType
from typing import Self

class ClientConfig:
    extra_headers: dict[str, str]

    def __init__(self, extra_headers: dict[str, str] | None = None) -> None: ...

class Client:
    config: ClientConfig

    def __init__(self, config: ClientConfig | None = None) -> None: ...
    def connect(self, url: str) -> None: ...
    def send(self, data: str | bytes) -> None: ...
    def recv(self) -> str | bytes: ...
    def close(self, code=1000, reason="") -> None: ...
    def __enter__(self) -> Self: ...
    def __exit__(
        self,
        exc_type: type[BaseException] | None,
        exc_value: BaseException | None,
        traceback: TracebackType | None,
        /,
    ) -> None: ...

def connect(url: str, config: ClientConfig | None = None) -> Client: ...

class AsyncClient:
    config: ClientConfig

    def __init__(self, config: ClientConfig | None = None) -> None: ...
    async def connect(self, url: str) -> None: ...
    async def send(self, data: str | bytes) -> None: ...
    async def recv(self) -> str | bytes: ...
    async def close(self, code=1000, reason="") -> None: ...
    async def __aenter__(self) -> Self: ...
    async def __aexit__(
        self,
        exc_type: type[BaseException] | None,
        exc_value: BaseException | None,
        traceback: TracebackType | None,
        /,
    ) -> None: ...

def aconnect(url: str, config: ClientConfig | None = None) -> AsyncClient: ...
