syng/socketio.pyi

47 lines
1.5 KiB
Python
Raw Normal View History

from typing import Any
from typing import Awaitable
from typing import Callable
from typing import Optional
from typing import TypeVar
Handler = TypeVar(
"Handler",
bound=Callable[[str, dict[str, Any]], Any] | Callable[[str], Any],
)
ClientHandler = TypeVar(
"ClientHandler", bound=Callable[[dict[str, Any]], Any] | Callable[[], Any]
)
2022-11-27 16:22:07 +01:00
class _session_context_manager:
async def __aenter__(self) -> dict[str, Any]: ...
async def __aexit__(self, *args: list[Any]) -> None: ...
class AsyncServer:
def __init__(
self,
cors_allowed_origins: str,
logger: bool,
engineio_logger: bool,
json: Any,
2022-11-27 16:22:07 +01:00
): ...
async def emit(
self,
message: str,
body: Any = None,
2022-11-27 16:22:07 +01:00
room: Optional[str] = None,
) -> None: ...
def session(self, sid: str) -> _session_context_manager: ...
def on(self, event: str) -> Callable[[Handler], Handler]: ...
async def enter_room(self, sid: str, room: str) -> None: ...
async def leave_room(self, sid: str, room: str) -> None: ...
2022-11-27 16:22:07 +01:00
def attach(self, app: Any) -> None: ...
2023-01-25 15:47:04 +00:00
async def disconnect(self, sid: str) -> None: ...
2022-11-27 16:22:07 +01:00
class AsyncClient:
def __init__(self, json: Any = None): ...
2022-11-27 16:22:07 +01:00
def on(self, event: str) -> Callable[[ClientHandler], ClientHandler]: ...
async def wait(self) -> None: ...
async def connect(self, server: str) -> None: ...
async def disconnect(self) -> None: ...
async def emit(self, message: str, data: Any = None) -> None: ...