python-socketio-stubs 5.13.0.0.20250802__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of python-socketio-stubs might be problematic. Click here for more details.
- python_socketio_stubs-5.13.0.0.20250802.dist-info/METADATA +67 -0
- python_socketio_stubs-5.13.0.0.20250802.dist-info/RECORD +36 -0
- python_socketio_stubs-5.13.0.0.20250802.dist-info/WHEEL +4 -0
- python_socketio_stubs-5.13.0.0.20250802.dist-info/licenses/LICENSE +21 -0
- socketio-stubs/__init__.pyi +49 -0
- socketio-stubs/_types.pyi +196 -0
- socketio-stubs/admin.pyi +86 -0
- socketio-stubs/asgi.pyi +16 -0
- socketio-stubs/async_admin.pyi +80 -0
- socketio-stubs/async_aiopika_manager.pyi +22 -0
- socketio-stubs/async_client.pyi +85 -0
- socketio-stubs/async_manager.pyi +30 -0
- socketio-stubs/async_namespace.pyi +103 -0
- socketio-stubs/async_pubsub_manager.pyi +43 -0
- socketio-stubs/async_redis_manager.pyi +22 -0
- socketio-stubs/async_server.pyi +176 -0
- socketio-stubs/async_simple_client.pyi +53 -0
- socketio-stubs/base_client.pyi +98 -0
- socketio-stubs/base_manager.pyi +39 -0
- socketio-stubs/base_namespace.pyi +24 -0
- socketio-stubs/base_server.pyi +85 -0
- socketio-stubs/client.pyi +83 -0
- socketio-stubs/exceptions.pyi +14 -0
- socketio-stubs/kafka_manager.pyi +15 -0
- socketio-stubs/kombu_manager.pyi +26 -0
- socketio-stubs/manager.pyi +32 -0
- socketio-stubs/middleware.pyi +21 -0
- socketio-stubs/msgpack_packet.pyi +12 -0
- socketio-stubs/namespace.pyi +99 -0
- socketio-stubs/packet.pyi +48 -0
- socketio-stubs/pubsub_manager.pyi +43 -0
- socketio-stubs/redis_manager.pyi +25 -0
- socketio-stubs/server.pyi +132 -0
- socketio-stubs/simple_client.pyi +52 -0
- socketio-stubs/tornado.pyi +4 -0
- socketio-stubs/zmq_manager.pyi +19 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
from collections.abc import Callable, Sequence
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from _typeshed import Incomplete
|
|
5
|
+
from socketio._types import DataType
|
|
6
|
+
from socketio.base_manager import BaseManager
|
|
7
|
+
|
|
8
|
+
class AsyncManager(BaseManager):
|
|
9
|
+
async def can_disconnect(self, sid: str, namespace: str) -> bool: ...
|
|
10
|
+
async def emit(
|
|
11
|
+
self,
|
|
12
|
+
event: str,
|
|
13
|
+
data: DataType | tuple[DataType, ...] | None,
|
|
14
|
+
namespace: str,
|
|
15
|
+
room: str | None = ...,
|
|
16
|
+
skip_sid: str | list[str] | None = ...,
|
|
17
|
+
callback: Callable[..., Incomplete] | None = ...,
|
|
18
|
+
to: str | None = ...,
|
|
19
|
+
**kwargs: Any,
|
|
20
|
+
) -> None: ...
|
|
21
|
+
async def connect(self, eio_sid: str, namespace: str) -> str: ... # pyright: ignore[reportIncompatibleMethodOverride]
|
|
22
|
+
async def disconnect(self, sid: str, namespace: str, **kwargs: Any) -> None: ...
|
|
23
|
+
async def enter_room(
|
|
24
|
+
self, sid: str, namespace: str, room: str, eio_sid: str | None = None
|
|
25
|
+
) -> None: ...
|
|
26
|
+
async def leave_room(self, sid: str, namespace: str, room: str) -> None: ...
|
|
27
|
+
async def close_room(self, room: str, namespace: str) -> None: ...
|
|
28
|
+
async def trigger_callback(
|
|
29
|
+
self, sid: str, id: str, data: Sequence[Incomplete]
|
|
30
|
+
) -> None: ...
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from typing import Any, Generic, Literal, NoReturn, overload
|
|
3
|
+
|
|
4
|
+
from _typeshed import Incomplete
|
|
5
|
+
from socketio._types import AsyncAsyncModeType, AsyncSessionContextManager, DataType
|
|
6
|
+
from socketio.async_client import AsyncClient
|
|
7
|
+
from socketio.async_server import AsyncServer
|
|
8
|
+
from socketio.base_namespace import BaseClientNamespace, BaseServerNamespace
|
|
9
|
+
from typing_extensions import TypeVar
|
|
10
|
+
|
|
11
|
+
_A = TypeVar("_A", bound=AsyncAsyncModeType, default=Any)
|
|
12
|
+
|
|
13
|
+
class AsyncNamespace(BaseServerNamespace[Literal[True]], Generic[_A]):
|
|
14
|
+
server: AsyncServer[_A] # pyright: ignore[reportIncompatibleVariableOverride]
|
|
15
|
+
async def trigger_event(self, event: str, *args: Any) -> Any: ...
|
|
16
|
+
async def emit(
|
|
17
|
+
self,
|
|
18
|
+
event: str,
|
|
19
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
20
|
+
to: str | None = ...,
|
|
21
|
+
room: str | None = ...,
|
|
22
|
+
skip_sid: str | list[str] | None = ...,
|
|
23
|
+
namespace: str | None = ...,
|
|
24
|
+
callback: Callable[..., Incomplete] | None = ...,
|
|
25
|
+
ignore_queue: bool = ...,
|
|
26
|
+
) -> None: ...
|
|
27
|
+
async def send(
|
|
28
|
+
self,
|
|
29
|
+
data: DataType | tuple[DataType, ...] | None,
|
|
30
|
+
to: str | None = ...,
|
|
31
|
+
room: str | None = ...,
|
|
32
|
+
skip_sid: str | list[str] | None = ...,
|
|
33
|
+
namespace: str | None = ...,
|
|
34
|
+
callback: Callable[..., Incomplete] | None = ...,
|
|
35
|
+
ignore_queue: bool = ...,
|
|
36
|
+
) -> None: ...
|
|
37
|
+
@overload
|
|
38
|
+
async def call(
|
|
39
|
+
self,
|
|
40
|
+
event: str,
|
|
41
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
42
|
+
to: None = ...,
|
|
43
|
+
sid: None = ...,
|
|
44
|
+
namespace: str | None = ...,
|
|
45
|
+
timeout: int = ...,
|
|
46
|
+
ignore_queue: bool = ...,
|
|
47
|
+
) -> NoReturn: ...
|
|
48
|
+
@overload
|
|
49
|
+
async def call(
|
|
50
|
+
self,
|
|
51
|
+
event: str,
|
|
52
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
53
|
+
to: str | None = ...,
|
|
54
|
+
sid: str | None = ...,
|
|
55
|
+
namespace: str | None = ...,
|
|
56
|
+
timeout: int = ...,
|
|
57
|
+
ignore_queue: bool = ...,
|
|
58
|
+
) -> Incomplete | None: ...
|
|
59
|
+
async def enter_room(
|
|
60
|
+
self, sid: str, room: str, namespace: str | None = ...
|
|
61
|
+
) -> None: ...
|
|
62
|
+
async def leave_room(
|
|
63
|
+
self, sid: str, room: str, namespace: str | None = ...
|
|
64
|
+
) -> None: ...
|
|
65
|
+
async def close_room(self, room: str, namespace: str | None = ...) -> None: ...
|
|
66
|
+
async def get_session(
|
|
67
|
+
self, sid: str, namespace: str | None = ...
|
|
68
|
+
) -> dict[Incomplete, Incomplete]: ...
|
|
69
|
+
async def save_session(
|
|
70
|
+
self,
|
|
71
|
+
sid: str,
|
|
72
|
+
session: dict[Incomplete, Incomplete],
|
|
73
|
+
namespace: str | None = ...,
|
|
74
|
+
) -> None: ...
|
|
75
|
+
def session(
|
|
76
|
+
self, sid: str, namespace: str | None = ...
|
|
77
|
+
) -> AsyncSessionContextManager: ...
|
|
78
|
+
async def disconnect(self, sid: str, namespace: str | None = ...) -> None: ...
|
|
79
|
+
|
|
80
|
+
class AsyncClientNamespace(BaseClientNamespace[Literal[True]]):
|
|
81
|
+
client: AsyncClient # pyright: ignore[reportIncompatibleVariableOverride]
|
|
82
|
+
async def trigger_event(self, event: str, *args: Any) -> Any: ...
|
|
83
|
+
async def emit(
|
|
84
|
+
self,
|
|
85
|
+
event: str,
|
|
86
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
87
|
+
namespace: str | None = ...,
|
|
88
|
+
callback: Callable[..., Incomplete] = ...,
|
|
89
|
+
) -> None: ...
|
|
90
|
+
async def send(
|
|
91
|
+
self,
|
|
92
|
+
data: DataType | tuple[DataType, ...] | None,
|
|
93
|
+
namespace: str | None = ...,
|
|
94
|
+
callback: Callable[..., Incomplete] = ...,
|
|
95
|
+
) -> None: ...
|
|
96
|
+
async def call(
|
|
97
|
+
self,
|
|
98
|
+
event: str,
|
|
99
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
100
|
+
namespace: str | None = ...,
|
|
101
|
+
timeout: int = ...,
|
|
102
|
+
) -> Incomplete | None: ...
|
|
103
|
+
async def disconnect(self) -> None: ...
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import logging
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from _typeshed import Incomplete
|
|
7
|
+
from socketio._types import DataType
|
|
8
|
+
from socketio.async_manager import AsyncManager
|
|
9
|
+
|
|
10
|
+
class AsyncPubSubManager(AsyncManager):
|
|
11
|
+
name: str
|
|
12
|
+
channel: str
|
|
13
|
+
write_only: bool
|
|
14
|
+
host_id: str
|
|
15
|
+
logger: logging.Logger | None
|
|
16
|
+
def __init__(
|
|
17
|
+
self,
|
|
18
|
+
channel: str = ...,
|
|
19
|
+
write_only: bool = ...,
|
|
20
|
+
logger: logging.Logger | None = ...,
|
|
21
|
+
) -> None: ...
|
|
22
|
+
thread: asyncio.Task[Any]
|
|
23
|
+
def initialize(self) -> None: ...
|
|
24
|
+
async def emit(
|
|
25
|
+
self,
|
|
26
|
+
event: str,
|
|
27
|
+
data: DataType | tuple[DataType, ...] | None,
|
|
28
|
+
namespace: str | None = ...,
|
|
29
|
+
room: str | None = ...,
|
|
30
|
+
skip_sid: str | list[str] | None = ...,
|
|
31
|
+
callback: Callable[..., Incomplete] | None = ...,
|
|
32
|
+
to: str | None = ...,
|
|
33
|
+
**kwargs: Any,
|
|
34
|
+
) -> None: ...
|
|
35
|
+
async def can_disconnect(self, sid: str, namespace: str) -> bool: ...
|
|
36
|
+
async def disconnect(
|
|
37
|
+
self, sid: str, namespace: str | None = ..., **kwargs: Any
|
|
38
|
+
) -> None: ...
|
|
39
|
+
async def enter_room(
|
|
40
|
+
self, sid: str, namespace: str, room: str, eio_sid: str | None = ...
|
|
41
|
+
) -> None: ...
|
|
42
|
+
async def leave_room(self, sid: str, namespace: str, room: str) -> None: ...
|
|
43
|
+
async def close_room(self, room: str, namespace: str | None = ...) -> None: ...
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from socketio._types import RedisArgs
|
|
5
|
+
from socketio.async_pubsub_manager import AsyncPubSubManager
|
|
6
|
+
|
|
7
|
+
def parse_redis_sentinel_url(
|
|
8
|
+
url: str,
|
|
9
|
+
) -> tuple[list[tuple[str, int]], str | None, RedisArgs]: ...
|
|
10
|
+
|
|
11
|
+
class AsyncRedisManager(AsyncPubSubManager):
|
|
12
|
+
name: str
|
|
13
|
+
redis_url: str
|
|
14
|
+
redis_options: dict[str, Any]
|
|
15
|
+
def __init__(
|
|
16
|
+
self,
|
|
17
|
+
url: str = ...,
|
|
18
|
+
channel: str = ...,
|
|
19
|
+
write_only: bool = ...,
|
|
20
|
+
logger: logging.Logger | None = ...,
|
|
21
|
+
redis_options: dict[str, Any] | None = ...,
|
|
22
|
+
) -> None: ...
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import logging
|
|
3
|
+
from collections.abc import Awaitable, Callable, Mapping
|
|
4
|
+
from typing import Any, Generic, Literal, NoReturn, ParamSpec, overload
|
|
5
|
+
|
|
6
|
+
import engineio
|
|
7
|
+
from _typeshed import Incomplete
|
|
8
|
+
from aiohttp.web import Application as AiohttpApplication
|
|
9
|
+
from engineio.async_drivers.asgi import ASGIApp as EngineIOASGIApp
|
|
10
|
+
from sanic import Sanic
|
|
11
|
+
from socketio import base_server as base_server
|
|
12
|
+
from socketio import exceptions as exceptions
|
|
13
|
+
from socketio import packet as packet
|
|
14
|
+
from socketio._types import (
|
|
15
|
+
AsyncAsyncModeType,
|
|
16
|
+
AsyncSessionContextManager,
|
|
17
|
+
DataType,
|
|
18
|
+
SocketIOModeType,
|
|
19
|
+
TransportType,
|
|
20
|
+
)
|
|
21
|
+
from socketio.asgi import ASGIApp as SocketIOASGIApp
|
|
22
|
+
from socketio.async_admin import InstrumentedAsyncServer
|
|
23
|
+
from socketio.async_manager import AsyncManager
|
|
24
|
+
from tornado.web import Application as TornadoApplication
|
|
25
|
+
from typing_extensions import TypeVar
|
|
26
|
+
|
|
27
|
+
_A = TypeVar("_A", bound=AsyncAsyncModeType, default=Any)
|
|
28
|
+
_P = ParamSpec("_P")
|
|
29
|
+
_T = TypeVar("_T")
|
|
30
|
+
|
|
31
|
+
task_reference_holder: set[Any]
|
|
32
|
+
|
|
33
|
+
class AsyncServer(
|
|
34
|
+
base_server.BaseServer[Literal[True], engineio.AsyncServer], Generic[_A]
|
|
35
|
+
):
|
|
36
|
+
def __init__(
|
|
37
|
+
self,
|
|
38
|
+
client_manager: AsyncManager | None = ...,
|
|
39
|
+
logger: logging.Logger | bool = ...,
|
|
40
|
+
json: Incomplete | None = ...,
|
|
41
|
+
async_handlers: bool = ...,
|
|
42
|
+
namespaces: list[str] | None = ...,
|
|
43
|
+
*,
|
|
44
|
+
async_mode: _A = ...,
|
|
45
|
+
ping_interval: int = ...,
|
|
46
|
+
ping_timeout: int = ...,
|
|
47
|
+
max_http_buffer_size: int = ...,
|
|
48
|
+
allow_upgrades: bool = ...,
|
|
49
|
+
http_compression: bool = ...,
|
|
50
|
+
compression_threshold: int = ...,
|
|
51
|
+
cookie: str | dict[str, str] | Callable[[], str] | bool | None = ...,
|
|
52
|
+
cors_allowed_origins: str | list[str] | None = ...,
|
|
53
|
+
cors_credentials: bool = ...,
|
|
54
|
+
monitor_clients: bool = ...,
|
|
55
|
+
transport: TransportType | None = ...,
|
|
56
|
+
engineio_logger: logging.Logger | bool = ...,
|
|
57
|
+
**kwargs: Incomplete,
|
|
58
|
+
) -> None: ...
|
|
59
|
+
@overload
|
|
60
|
+
def attach(
|
|
61
|
+
self: AsyncServer[Literal["aiohttp"]],
|
|
62
|
+
app: AiohttpApplication,
|
|
63
|
+
socketio_path: str = ...,
|
|
64
|
+
) -> None: ...
|
|
65
|
+
@overload
|
|
66
|
+
def attach(
|
|
67
|
+
self: AsyncServer[Literal["sanic"]],
|
|
68
|
+
app: Sanic[Any, Any],
|
|
69
|
+
socketio_path: str = ...,
|
|
70
|
+
) -> None: ...
|
|
71
|
+
@overload
|
|
72
|
+
def attach(
|
|
73
|
+
self: AsyncServer[Literal["asgi"]],
|
|
74
|
+
app: EngineIOASGIApp | SocketIOASGIApp,
|
|
75
|
+
socketio_path: str = ...,
|
|
76
|
+
) -> None: ...
|
|
77
|
+
@overload
|
|
78
|
+
def attach(
|
|
79
|
+
self: AsyncServer[Literal["tornado"]],
|
|
80
|
+
app: TornadoApplication,
|
|
81
|
+
socketio_path: str = ...,
|
|
82
|
+
) -> None: ...
|
|
83
|
+
@overload
|
|
84
|
+
def attach(
|
|
85
|
+
self,
|
|
86
|
+
app: AiohttpApplication
|
|
87
|
+
| Sanic[Any, Any]
|
|
88
|
+
| EngineIOASGIApp
|
|
89
|
+
| TornadoApplication
|
|
90
|
+
| SocketIOASGIApp,
|
|
91
|
+
socketio_path: str = ...,
|
|
92
|
+
) -> None: ...
|
|
93
|
+
async def emit(
|
|
94
|
+
self,
|
|
95
|
+
event: str,
|
|
96
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
97
|
+
to: str | None = ...,
|
|
98
|
+
room: str | None = ...,
|
|
99
|
+
skip_sid: str | list[str] | None = ...,
|
|
100
|
+
namespace: str | None = ...,
|
|
101
|
+
callback: Callable[..., Incomplete] | None = ...,
|
|
102
|
+
ignore_queue: bool = ...,
|
|
103
|
+
) -> None: ...
|
|
104
|
+
async def send(
|
|
105
|
+
self,
|
|
106
|
+
data: DataType | tuple[DataType, ...] | None,
|
|
107
|
+
to: str | None = ...,
|
|
108
|
+
room: str | None = ...,
|
|
109
|
+
skip_sid: str | list[str] | None = ...,
|
|
110
|
+
namespace: str | None = ...,
|
|
111
|
+
callback: Callable[..., Incomplete] | None = ...,
|
|
112
|
+
ignore_queue: bool = ...,
|
|
113
|
+
) -> None: ...
|
|
114
|
+
@overload
|
|
115
|
+
async def call(
|
|
116
|
+
self,
|
|
117
|
+
event: str,
|
|
118
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
119
|
+
to: None = ...,
|
|
120
|
+
sid: None = ...,
|
|
121
|
+
namespace: str | None = ...,
|
|
122
|
+
timeout: int = ...,
|
|
123
|
+
ignore_queue: bool = ...,
|
|
124
|
+
) -> NoReturn: ...
|
|
125
|
+
@overload
|
|
126
|
+
async def call(
|
|
127
|
+
self,
|
|
128
|
+
event: str,
|
|
129
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
130
|
+
to: str | None = ...,
|
|
131
|
+
sid: str | None = ...,
|
|
132
|
+
namespace: str | None = ...,
|
|
133
|
+
timeout: int = ...,
|
|
134
|
+
ignore_queue: bool = ...,
|
|
135
|
+
) -> Incomplete | None: ...
|
|
136
|
+
async def enter_room(
|
|
137
|
+
self, sid: str, room: str, namespace: str | None = ...
|
|
138
|
+
) -> None: ...
|
|
139
|
+
async def leave_room(
|
|
140
|
+
self, sid: str, room: str, namespace: str | None = ...
|
|
141
|
+
) -> None: ...
|
|
142
|
+
async def close_room(self, room: str, namespace: str | None = ...) -> None: ...
|
|
143
|
+
async def get_session(
|
|
144
|
+
self, sid: str, namespace: str | None = ...
|
|
145
|
+
) -> dict[Incomplete, Incomplete]: ...
|
|
146
|
+
async def save_session(
|
|
147
|
+
self,
|
|
148
|
+
sid: str,
|
|
149
|
+
session: dict[Incomplete, Incomplete],
|
|
150
|
+
namespace: str | None = ...,
|
|
151
|
+
) -> None: ...
|
|
152
|
+
def session(
|
|
153
|
+
self, sid: str, namespace: str | None = ...
|
|
154
|
+
) -> AsyncSessionContextManager: ...
|
|
155
|
+
async def disconnect(
|
|
156
|
+
self, sid: str, namespace: str | None = ..., ignore_queue: bool = ...
|
|
157
|
+
) -> None: ...
|
|
158
|
+
async def shutdown(self) -> None: ...
|
|
159
|
+
async def handle_request(
|
|
160
|
+
self,
|
|
161
|
+
environ: Mapping[str, Incomplete],
|
|
162
|
+
start_response: Callable[[str, str], Incomplete],
|
|
163
|
+
) -> list[str | list[tuple[str, str]] | bytes]: ...
|
|
164
|
+
def start_background_task(
|
|
165
|
+
self, target: Callable[_P, Awaitable[_T]], *args: _P.args, **kwargs: _P.kwargs
|
|
166
|
+
) -> asyncio.Task[_T]: ...
|
|
167
|
+
async def sleep(self, seconds: int = ...) -> None: ...
|
|
168
|
+
def instrument(
|
|
169
|
+
self,
|
|
170
|
+
auth: Incomplete | None = ...,
|
|
171
|
+
mode: SocketIOModeType = ...,
|
|
172
|
+
read_only: bool = ...,
|
|
173
|
+
server_id: str | None = ...,
|
|
174
|
+
namespace: str = ...,
|
|
175
|
+
server_stats_interval: int = ...,
|
|
176
|
+
) -> InstrumentedAsyncServer: ...
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import types
|
|
3
|
+
from typing import Any, ClassVar, Literal
|
|
4
|
+
|
|
5
|
+
from _typeshed import Incomplete
|
|
6
|
+
from socketio import Client
|
|
7
|
+
from socketio._types import DataType, TransportType
|
|
8
|
+
from socketio.async_client import AsyncClient
|
|
9
|
+
from typing_extensions import Self
|
|
10
|
+
|
|
11
|
+
class AsyncSimpleClient:
|
|
12
|
+
client_class: ClassVar[type[AsyncClient]]
|
|
13
|
+
client_args: tuple[Any, ...]
|
|
14
|
+
client_kwargs: dict[str, Any]
|
|
15
|
+
client: Client | None
|
|
16
|
+
namespace: str
|
|
17
|
+
connected_event: asyncio.Event
|
|
18
|
+
connected: bool
|
|
19
|
+
input_event: asyncio.Event
|
|
20
|
+
input_buffer: list[list[Any]]
|
|
21
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None: ...
|
|
22
|
+
async def connect(
|
|
23
|
+
self,
|
|
24
|
+
url: str,
|
|
25
|
+
headers: dict[Incomplete, Incomplete] = ...,
|
|
26
|
+
auth: Incomplete | None = ...,
|
|
27
|
+
transports: TransportType | None = ...,
|
|
28
|
+
namespace: str = ...,
|
|
29
|
+
socketio_path: str = ...,
|
|
30
|
+
wait_timeout: int = ...,
|
|
31
|
+
) -> None: ...
|
|
32
|
+
@property
|
|
33
|
+
def sid(self) -> str | None: ...
|
|
34
|
+
@property
|
|
35
|
+
def transport(self) -> TransportType | Literal[""]: ...
|
|
36
|
+
async def emit(
|
|
37
|
+
self, event: str, data: DataType | tuple[DataType, ...] | None = ...
|
|
38
|
+
) -> None: ...
|
|
39
|
+
async def call(
|
|
40
|
+
self,
|
|
41
|
+
event: str,
|
|
42
|
+
data: DataType | tuple[DataType, ...] | None = ...,
|
|
43
|
+
timeout: int = ...,
|
|
44
|
+
) -> Incomplete | None: ...
|
|
45
|
+
async def receive(self, timeout: float | None = ...) -> list[Any]: ...
|
|
46
|
+
async def disconnect(self) -> None: ...
|
|
47
|
+
async def __aenter__(self) -> Self: ...
|
|
48
|
+
async def __exit__(
|
|
49
|
+
self,
|
|
50
|
+
exc_type: type[BaseException] | None,
|
|
51
|
+
exc_val: BaseException | None,
|
|
52
|
+
exc_tb: types.TracebackType | None,
|
|
53
|
+
) -> None: ...
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from collections.abc import Callable
|
|
3
|
+
from types import FrameType
|
|
4
|
+
from typing import Any, ClassVar, Generic, Literal, overload
|
|
5
|
+
|
|
6
|
+
import engineio
|
|
7
|
+
from _typeshed import Incomplete
|
|
8
|
+
from engineio import AsyncClient, Client
|
|
9
|
+
from socketio import base_namespace
|
|
10
|
+
from socketio._types import TransportType
|
|
11
|
+
from typing_extensions import TypeVar
|
|
12
|
+
|
|
13
|
+
_T_co = TypeVar("_T_co", bound=Client | AsyncClient, covariant=True, default=Any)
|
|
14
|
+
_IsAsyncio = TypeVar("_IsAsyncio", bound=bool, default=Literal[False])
|
|
15
|
+
_F = TypeVar("_F", bound=Callable[..., Any])
|
|
16
|
+
|
|
17
|
+
default_logger: logging.Logger
|
|
18
|
+
reconnecting_clients: list[BaseClient[Any]]
|
|
19
|
+
|
|
20
|
+
def signal_handler(sig: int, frame: FrameType | None) -> Any: ...
|
|
21
|
+
|
|
22
|
+
original_signal_handler: Callable[[int, FrameType | None], Any] | None
|
|
23
|
+
|
|
24
|
+
class BaseClient(Generic[_IsAsyncio, _T_co]):
|
|
25
|
+
reserved_events: ClassVar[list[str]]
|
|
26
|
+
reason: ClassVar[type[engineio.Client.reason]]
|
|
27
|
+
reconnection: bool
|
|
28
|
+
reconnection_attempts: int
|
|
29
|
+
reconnection_delay: int
|
|
30
|
+
reconnection_delay_max: int
|
|
31
|
+
randomization_factor: float
|
|
32
|
+
handle_sigint: bool
|
|
33
|
+
packet_class: Incomplete
|
|
34
|
+
eio: _T_co
|
|
35
|
+
logger: logging.Logger
|
|
36
|
+
connection_url: str | None
|
|
37
|
+
connection_headers: dict[Incomplete, Incomplete] | None
|
|
38
|
+
connection_auth: Incomplete | None
|
|
39
|
+
connection_transports: TransportType | None
|
|
40
|
+
connection_namespaces: list[str]
|
|
41
|
+
socketio_path: str | None
|
|
42
|
+
sid: str | None
|
|
43
|
+
connected: bool
|
|
44
|
+
namespaces: dict[str, str | None]
|
|
45
|
+
handlers: dict[str, Callable[..., Incomplete]]
|
|
46
|
+
namespace_handlers: dict[str, Callable[..., Incomplete]]
|
|
47
|
+
callbacks: dict[str, dict[int, Callable[..., Incomplete]]]
|
|
48
|
+
def __init__(
|
|
49
|
+
self,
|
|
50
|
+
reconnection: bool = ...,
|
|
51
|
+
reconnection_attempts: int = ...,
|
|
52
|
+
reconnection_delay: int = ...,
|
|
53
|
+
reconnection_delay_max: int = ...,
|
|
54
|
+
randomization_factor: float = ...,
|
|
55
|
+
logger: logging.Logger | bool = ...,
|
|
56
|
+
serializer: str = ...,
|
|
57
|
+
json: Incomplete | None = ...,
|
|
58
|
+
handle_sigint: bool = ...,
|
|
59
|
+
**kwargs: Any,
|
|
60
|
+
) -> None: ...
|
|
61
|
+
def is_asyncio_based(self) -> _IsAsyncio: ...
|
|
62
|
+
@overload
|
|
63
|
+
def on(
|
|
64
|
+
self,
|
|
65
|
+
event: Callable[..., Incomplete],
|
|
66
|
+
handler: None = ...,
|
|
67
|
+
namespace: None = ...,
|
|
68
|
+
) -> None: ...
|
|
69
|
+
@overload
|
|
70
|
+
def on(
|
|
71
|
+
self,
|
|
72
|
+
event: str,
|
|
73
|
+
handler: Callable[..., Incomplete],
|
|
74
|
+
namespace: str | None = ...,
|
|
75
|
+
) -> Callable[[_F], _F] | None: ...
|
|
76
|
+
@overload
|
|
77
|
+
def on(
|
|
78
|
+
self,
|
|
79
|
+
event: str | Callable[..., Incomplete],
|
|
80
|
+
handler: Callable[..., Incomplete] | None = ...,
|
|
81
|
+
namespace: str | None = ...,
|
|
82
|
+
) -> Callable[[_F], _F] | None: ...
|
|
83
|
+
@overload
|
|
84
|
+
def event(self, handler: Callable[..., Incomplete]) -> None: ...
|
|
85
|
+
@overload
|
|
86
|
+
def event(
|
|
87
|
+
self, handler: Callable[..., Incomplete], namespace: str | None
|
|
88
|
+
) -> Callable[[_F], _F]: ...
|
|
89
|
+
@overload
|
|
90
|
+
def event(
|
|
91
|
+
self, handler: Callable[..., Incomplete], namespace: str | None = ...
|
|
92
|
+
) -> Callable[[_F], _F] | None: ...
|
|
93
|
+
def register_namespace(
|
|
94
|
+
self, namespace_handler: base_namespace.BaseClientNamespace
|
|
95
|
+
) -> None: ...
|
|
96
|
+
def get_sid(self, namespace: str | None = ...) -> str | None: ...
|
|
97
|
+
def transport(self) -> TransportType: ...
|
|
98
|
+
def _engineio_client_class(self) -> type[_T_co]: ...
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from collections.abc import Callable, Generator, KeysView, Sequence
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from _typeshed import Incomplete
|
|
6
|
+
from bidict import bidict
|
|
7
|
+
from socketio.base_server import BaseServer
|
|
8
|
+
|
|
9
|
+
default_logger: logging.Logger
|
|
10
|
+
|
|
11
|
+
class BaseManager:
|
|
12
|
+
logger: logging.Logger | None
|
|
13
|
+
server: BaseServer[Any, Any]
|
|
14
|
+
rooms: dict[ # self.rooms[namespace][room][sio_sid] = eio_sid
|
|
15
|
+
str, dict[str | None, bidict[str, str]]
|
|
16
|
+
]
|
|
17
|
+
eio_to_sid: dict[str, str]
|
|
18
|
+
callbacks: dict[str, dict[int, Callable[..., Incomplete]]]
|
|
19
|
+
pending_disconnect: dict[str, list[str]]
|
|
20
|
+
def __init__(self) -> None: ...
|
|
21
|
+
def set_server(self, server: BaseServer[Any, Any]) -> None: ...
|
|
22
|
+
def initialize(self) -> None: ...
|
|
23
|
+
def get_namespaces(self) -> KeysView[dict[str, Any]]: ...
|
|
24
|
+
def get_participants(
|
|
25
|
+
self, namespace: str, room: str | Sequence[str] | None
|
|
26
|
+
) -> Generator[tuple[str, str]]: ...
|
|
27
|
+
def connect(self, eio_sid: str, namespace: str) -> str: ...
|
|
28
|
+
def is_connected(self, sid: str, namespace: str) -> bool: ...
|
|
29
|
+
def sid_from_eio_sid(self, eio_sid: str, namespace: str) -> str: ...
|
|
30
|
+
def eio_sid_from_sid(self, sid: str, namespace: str) -> str | None: ...
|
|
31
|
+
def pre_disconnect(self, sid: str, namespace: str) -> str | None: ...
|
|
32
|
+
def basic_disconnect(self, sid: str, namespace: str, **kwargs: Any) -> None: ...
|
|
33
|
+
def basic_enter_room(
|
|
34
|
+
self, sid: str, namespace: str, room: str, eio_sid: str | None = ...
|
|
35
|
+
) -> None: ...
|
|
36
|
+
def basic_leave_room(self, sid: str, namespace: str, room: str) -> None: ...
|
|
37
|
+
def basic_close_room(self, room: str | Sequence[str], namespace: str) -> None: ...
|
|
38
|
+
def get_rooms(self, sid: str, namespace: str) -> list[str]: ...
|
|
39
|
+
def _get_logger(self) -> logging.Logger: ...
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from typing import Any, Generic, Literal
|
|
2
|
+
|
|
3
|
+
from _typeshed import Incomplete
|
|
4
|
+
from socketio.base_client import BaseClient
|
|
5
|
+
from socketio.base_server import BaseServer
|
|
6
|
+
from typing_extensions import TypeVar
|
|
7
|
+
|
|
8
|
+
_IsAsyncio = TypeVar("_IsAsyncio", bound=bool, default=Literal[False])
|
|
9
|
+
|
|
10
|
+
class BaseNamespace(Generic[_IsAsyncio]):
|
|
11
|
+
namespace: str
|
|
12
|
+
def __init__(self, namespace: str | None = ...) -> None: ...
|
|
13
|
+
def is_asyncio_based(self) -> _IsAsyncio: ...
|
|
14
|
+
|
|
15
|
+
class BaseServerNamespace(BaseNamespace[_IsAsyncio], Generic[_IsAsyncio]):
|
|
16
|
+
server: BaseServer[_IsAsyncio, Any] | None
|
|
17
|
+
def __init__(self, namespace: str | None = ...) -> None: ...
|
|
18
|
+
def rooms(self, sid: str, namespace: str | None = ...) -> Incomplete: ...
|
|
19
|
+
def _set_server(self, server: BaseServer[_IsAsyncio, Any]) -> None: ...
|
|
20
|
+
|
|
21
|
+
class BaseClientNamespace(BaseNamespace[_IsAsyncio], Generic[_IsAsyncio]):
|
|
22
|
+
client: BaseClient[_IsAsyncio, Any] | None
|
|
23
|
+
def __init__(self, namespace: str | None = ...) -> None: ...
|
|
24
|
+
def _set_client(self, client: BaseClient[_IsAsyncio, Any]) -> None: ...
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from collections.abc import Callable, Mapping
|
|
3
|
+
from typing import Any, ClassVar, Generic, Literal, overload
|
|
4
|
+
|
|
5
|
+
import engineio
|
|
6
|
+
from _typeshed import Incomplete
|
|
7
|
+
from engineio import AsyncServer, Server
|
|
8
|
+
from socketio import base_namespace
|
|
9
|
+
from socketio._types import SyncAsyncModeType, TransportType
|
|
10
|
+
from socketio.manager import Manager
|
|
11
|
+
from typing_extensions import TypeVar
|
|
12
|
+
|
|
13
|
+
_T_co = TypeVar("_T_co", bound=Server | AsyncServer, covariant=True, default=Any)
|
|
14
|
+
_F = TypeVar("_F", bound=Callable[..., Any])
|
|
15
|
+
_IsAsyncio = TypeVar("_IsAsyncio", bound=bool, default=Literal[False])
|
|
16
|
+
|
|
17
|
+
default_logger: logging.Logger
|
|
18
|
+
|
|
19
|
+
class BaseServer(Generic[_IsAsyncio, _T_co]):
|
|
20
|
+
reserved_events: ClassVar[list[str]]
|
|
21
|
+
reason: ClassVar[type[engineio.Client.reason]]
|
|
22
|
+
packet_class: Incomplete
|
|
23
|
+
eio: _T_co
|
|
24
|
+
environ: Mapping[str, Incomplete]
|
|
25
|
+
handlers: Callable[..., Incomplete]
|
|
26
|
+
namespace_handlers: dict[str, Callable[..., Incomplete]]
|
|
27
|
+
not_handled: object
|
|
28
|
+
logger: logging.Logger
|
|
29
|
+
manager: Manager
|
|
30
|
+
manager_initialized: bool
|
|
31
|
+
async_handlers: bool
|
|
32
|
+
always_connect: bool
|
|
33
|
+
namespaces: list[str]
|
|
34
|
+
async_mode: SyncAsyncModeType
|
|
35
|
+
def __init__(
|
|
36
|
+
self,
|
|
37
|
+
client_manager: Manager | None = ...,
|
|
38
|
+
logger: logging.Logger | bool = ...,
|
|
39
|
+
serializer: str = ...,
|
|
40
|
+
json: Incomplete | None = ...,
|
|
41
|
+
async_handlers: bool = ...,
|
|
42
|
+
always_connect: bool = ...,
|
|
43
|
+
namespaces: list[str] | None = ...,
|
|
44
|
+
**kwargs: Any,
|
|
45
|
+
) -> None: ...
|
|
46
|
+
def is_asyncio_based(self) -> _IsAsyncio: ...
|
|
47
|
+
@overload
|
|
48
|
+
def on(
|
|
49
|
+
self,
|
|
50
|
+
event: Callable[..., Incomplete],
|
|
51
|
+
handler: None = ...,
|
|
52
|
+
namespace: None = ...,
|
|
53
|
+
) -> None: ...
|
|
54
|
+
@overload
|
|
55
|
+
def on(
|
|
56
|
+
self,
|
|
57
|
+
event: str,
|
|
58
|
+
handler: Callable[..., Incomplete],
|
|
59
|
+
namespace: str | None = ...,
|
|
60
|
+
) -> Callable[[_F], _F] | None: ...
|
|
61
|
+
@overload
|
|
62
|
+
def on(
|
|
63
|
+
self,
|
|
64
|
+
event: str | Callable[..., Incomplete],
|
|
65
|
+
handler: Callable[..., Incomplete] | None = ...,
|
|
66
|
+
namespace: str | None = ...,
|
|
67
|
+
) -> Callable[[_F], _F] | None: ...
|
|
68
|
+
@overload
|
|
69
|
+
def event(self, handler: Callable[..., Incomplete]) -> None: ...
|
|
70
|
+
@overload
|
|
71
|
+
def event(
|
|
72
|
+
self, handler: Callable[..., Incomplete], namespace: str | None
|
|
73
|
+
) -> Callable[[_F], _F]: ...
|
|
74
|
+
@overload
|
|
75
|
+
def event(
|
|
76
|
+
self, handler: Callable[..., Incomplete], namespace: str | None = ...
|
|
77
|
+
) -> Callable[[_F], _F] | None: ...
|
|
78
|
+
def register_namespace(
|
|
79
|
+
self, namespace_handler: base_namespace.BaseClientNamespace[_IsAsyncio]
|
|
80
|
+
) -> None: ...
|
|
81
|
+
def rooms(self, sid: str, namespace: str | None = ...) -> str | list[str]: ...
|
|
82
|
+
def transport(self, sid: str, namespace: str | None = ...) -> TransportType: ...
|
|
83
|
+
def get_environ(
|
|
84
|
+
self, sid: str, namespace: str | None = ...
|
|
85
|
+
) -> Incomplete | None: ...
|