python-engineio 4.13.0__tar.gz → 4.13.2__tar.gz
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.
- {python_engineio-4.13.0/src/python_engineio.egg-info → python_engineio-4.13.2}/PKG-INFO +3 -2
- {python_engineio-4.13.0 → python_engineio-4.13.2}/pyproject.toml +3 -2
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_client.py +3 -2
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/aiohttp.py +3 -1
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/asgi.py +12 -13
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_server.py +6 -4
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_socket.py +4 -2
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/base_socket.py +4 -1
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/client.py +3 -2
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/server.py +6 -4
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/socket.py +4 -2
- {python_engineio-4.13.0 → python_engineio-4.13.2/src/python_engineio.egg-info}/PKG-INFO +3 -2
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/python_engineio.egg-info/SOURCES.txt +0 -9
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/python_engineio.egg-info/dependency_links.txt +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/python_engineio.egg-info/not-zip-safe +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/python_engineio.egg-info/requires.txt +2 -1
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/python_engineio.egg-info/top_level.txt +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/async/test_socket.py +18 -2
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/common/test_socket.py +14 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tox.ini +1 -15
- python_engineio-4.13.0/docs/Makefile +0 -19
- python_engineio-4.13.0/docs/api.rst +0 -33
- python_engineio-4.13.0/docs/client.rst +0 -211
- python_engineio-4.13.0/docs/conf.py +0 -186
- python_engineio-4.13.0/docs/index.rst +0 -23
- python_engineio-4.13.0/docs/intro.rst +0 -152
- python_engineio-4.13.0/docs/make.bat +0 -35
- python_engineio-4.13.0/docs/server.rst +0 -674
- python_engineio-4.13.0/tests/common/__init__.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/LICENSE +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/MANIFEST.in +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/README.md +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/docs/_static/README.md +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/setup.cfg +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/__init__.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/__init__.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/_websocket_wsgi.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/eventlet.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/gevent.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/gevent_uwsgi.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/sanic.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/threading.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/async_drivers/tornado.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/base_client.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/base_server.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/exceptions.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/json.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/middleware.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/packet.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/payload.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/src/engineio/static_files.py +0 -0
- {python_engineio-4.13.0/tests → python_engineio-4.13.2/tests/async}/__init__.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/async/index.html +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/async/test_aiohttp.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/async/test_asgi.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/async/test_client.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/async/test_sanic.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/async/test_server.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/async/test_tornado.py +0 -0
- {python_engineio-4.13.0/tests/async → python_engineio-4.13.2/tests/common}/__init__.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/common/index.html +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/common/test_client.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/common/test_middleware.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/common/test_packet.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/common/test_payload.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/common/test_server.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/performance/README.md +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/performance/binary_b64_packet.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/performance/binary_packet.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/performance/json_packet.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/performance/payload.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/performance/run.sh +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/performance/server_receive.py +0 -0
- {python_engineio-4.13.0 → python_engineio-4.13.2}/tests/performance/text_packet.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-engineio
|
|
3
|
-
Version: 4.13.
|
|
3
|
+
Version: 4.13.2
|
|
4
4
|
Summary: Engine.IO server and client for Python
|
|
5
5
|
Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -18,11 +18,12 @@ Provides-Extra: client
|
|
|
18
18
|
Requires-Dist: requests>=2.21.0; extra == "client"
|
|
19
19
|
Requires-Dist: websocket-client>=0.54.0; extra == "client"
|
|
20
20
|
Provides-Extra: asyncio-client
|
|
21
|
-
Requires-Dist: aiohttp>=3.
|
|
21
|
+
Requires-Dist: aiohttp>=3.11; extra == "asyncio-client"
|
|
22
22
|
Provides-Extra: dev
|
|
23
23
|
Requires-Dist: tox; extra == "dev"
|
|
24
24
|
Provides-Extra: docs
|
|
25
25
|
Requires-Dist: sphinx; extra == "docs"
|
|
26
|
+
Requires-Dist: furo; extra == "docs"
|
|
26
27
|
Dynamic: license-file
|
|
27
28
|
|
|
28
29
|
python-engineio
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "python-engineio"
|
|
3
|
-
version = "4.13.
|
|
3
|
+
version = "4.13.2"
|
|
4
4
|
license = {text = "MIT"}
|
|
5
5
|
authors = [{name = "Miguel Grinberg", email = "miguel.grinberg@gmail.com"}]
|
|
6
6
|
description = "Engine.IO server and client for Python"
|
|
@@ -27,13 +27,14 @@ client = [
|
|
|
27
27
|
"websocket-client >= 0.54.0",
|
|
28
28
|
]
|
|
29
29
|
asyncio_client = [
|
|
30
|
-
"aiohttp >= 3.
|
|
30
|
+
"aiohttp >= 3.11"
|
|
31
31
|
]
|
|
32
32
|
dev = [
|
|
33
33
|
"tox",
|
|
34
34
|
]
|
|
35
35
|
docs = [
|
|
36
36
|
"sphinx",
|
|
37
|
+
"furo",
|
|
37
38
|
]
|
|
38
39
|
|
|
39
40
|
[tool.setuptools]
|
|
@@ -55,10 +55,11 @@ class AsyncClient(base_client.BaseClient):
|
|
|
55
55
|
use. To disable logging set to ``False``. The default is
|
|
56
56
|
``False``. Note that fatal errors are logged even when
|
|
57
57
|
``logger`` is ``False``.
|
|
58
|
-
:param json: An alternative
|
|
58
|
+
:param json: An alternative JSON module to use for encoding and decoding
|
|
59
59
|
packets. Custom json modules must have ``dumps`` and ``loads``
|
|
60
60
|
functions that are compatible with the standard library
|
|
61
|
-
versions.
|
|
61
|
+
versions. This is a process-wide setting, all instantiated
|
|
62
|
+
servers and clients must use the same JSON module.
|
|
62
63
|
:param request_timeout: A timeout in seconds for requests. The default is
|
|
63
64
|
5 seconds.
|
|
64
65
|
:param http_session: an initialized ``aiohttp.ClientSession`` object to be
|
|
@@ -79,11 +79,13 @@ class WebSocket: # pragma: no cover
|
|
|
79
79
|
"""
|
|
80
80
|
def __init__(self, handler, server):
|
|
81
81
|
self.handler = handler
|
|
82
|
+
self.server = server
|
|
82
83
|
self._sock = None
|
|
83
84
|
|
|
84
85
|
async def __call__(self, environ):
|
|
85
86
|
request = environ['aiohttp.request']
|
|
86
|
-
self._sock = WebSocketResponse(
|
|
87
|
+
self._sock = WebSocketResponse(
|
|
88
|
+
max_msg_size=self.server.max_http_buffer_size)
|
|
87
89
|
await self._sock.prepare(request)
|
|
88
90
|
|
|
89
91
|
self.environ = environ
|
|
@@ -136,10 +136,18 @@ class ASGIApp:
|
|
|
136
136
|
|
|
137
137
|
async def translate_request(scope, receive, send):
|
|
138
138
|
class AwaitablePayload: # pragma: no cover
|
|
139
|
-
def __init__(self,
|
|
140
|
-
self.
|
|
139
|
+
def __init__(self, event):
|
|
140
|
+
self.event = event
|
|
141
|
+
self.payload = None
|
|
141
142
|
|
|
142
143
|
async def read(self, length=None):
|
|
144
|
+
if self.payload is None and event['type'] == 'http.request':
|
|
145
|
+
# read payload from http request
|
|
146
|
+
self.payload = self.event.get('body') or b''
|
|
147
|
+
while self.event.get('more_body'):
|
|
148
|
+
self.event = await receive()
|
|
149
|
+
if self.event['type'] == 'http.request':
|
|
150
|
+
self.payload += self.event.get('body') or b''
|
|
143
151
|
if length is None:
|
|
144
152
|
r = self.payload
|
|
145
153
|
self.payload = b''
|
|
@@ -149,16 +157,7 @@ async def translate_request(scope, receive, send):
|
|
|
149
157
|
return r
|
|
150
158
|
|
|
151
159
|
event = await receive()
|
|
152
|
-
|
|
153
|
-
if event['type'] == 'http.request':
|
|
154
|
-
payload += event.get('body') or b''
|
|
155
|
-
while event.get('more_body'):
|
|
156
|
-
event = await receive()
|
|
157
|
-
if event['type'] == 'http.request':
|
|
158
|
-
payload += event.get('body') or b''
|
|
159
|
-
elif event['type'] == 'websocket.connect':
|
|
160
|
-
pass
|
|
161
|
-
else:
|
|
160
|
+
if event['type'] not in ['http.request', 'websocket.connect']:
|
|
162
161
|
return {}
|
|
163
162
|
|
|
164
163
|
raw_uri = scope['path']
|
|
@@ -171,7 +170,7 @@ async def translate_request(scope, receive, send):
|
|
|
171
170
|
else:
|
|
172
171
|
raw_uri += '?' + query_string
|
|
173
172
|
environ = {
|
|
174
|
-
'wsgi.input': AwaitablePayload(
|
|
173
|
+
'wsgi.input': AwaitablePayload(event),
|
|
175
174
|
'wsgi.errors': sys.stderr,
|
|
176
175
|
'wsgi.version': (1, 0),
|
|
177
176
|
'wsgi.async': True,
|
|
@@ -64,10 +64,11 @@ class AsyncServer(base_server.BaseServer):
|
|
|
64
64
|
:param logger: To enable logging set to ``True`` or pass a logger object to
|
|
65
65
|
use. To disable logging set to ``False``. Note that fatal
|
|
66
66
|
errors are logged even when ``logger`` is ``False``.
|
|
67
|
-
:param json: An alternative
|
|
68
|
-
packets. Custom
|
|
67
|
+
:param json: An alternative JSON module to use for encoding and decoding
|
|
68
|
+
packets. Custom JSON modules must have ``dumps`` and ``loads``
|
|
69
69
|
functions that are compatible with the standard library
|
|
70
|
-
versions.
|
|
70
|
+
versions. This is a process-wide setting, all instantiated
|
|
71
|
+
servers and clients must use the same JSON module.
|
|
71
72
|
:param async_handlers: If set to ``True``, run message event handlers in
|
|
72
73
|
non-blocking threads. To run handlers synchronously,
|
|
73
74
|
set to ``False``. The default is ``True``.
|
|
@@ -461,7 +462,6 @@ class AsyncServer(base_server.BaseServer):
|
|
|
461
462
|
'maxPayload': self.max_http_buffer_size,
|
|
462
463
|
})
|
|
463
464
|
await s.send(pkt)
|
|
464
|
-
s.schedule_ping()
|
|
465
465
|
|
|
466
466
|
ret = await self._trigger_event('connect', sid, environ,
|
|
467
467
|
run_async=False)
|
|
@@ -470,6 +470,8 @@ class AsyncServer(base_server.BaseServer):
|
|
|
470
470
|
self.logger.warning('Application rejected connection')
|
|
471
471
|
return self._unauthorized(ret or None)
|
|
472
472
|
|
|
473
|
+
s.schedule_ping()
|
|
474
|
+
|
|
473
475
|
if transport == 'websocket':
|
|
474
476
|
ret = await s.handle_get_request(environ)
|
|
475
477
|
if s.closed and sid in self.sockets:
|
|
@@ -128,10 +128,12 @@ class AsyncSocket(base_socket.BaseSocket):
|
|
|
128
128
|
await self.queue.join()
|
|
129
129
|
|
|
130
130
|
def schedule_ping(self):
|
|
131
|
-
|
|
131
|
+
# only schedule a new ping if the previous ping wait cycle completed
|
|
132
|
+
if self.last_ping:
|
|
133
|
+
self.last_ping = None
|
|
134
|
+
self.server.start_background_task(self._send_ping)
|
|
132
135
|
|
|
133
136
|
async def _send_ping(self):
|
|
134
|
-
self.last_ping = None
|
|
135
137
|
await asyncio.sleep(self.server.ping_interval)
|
|
136
138
|
if not self.closing and not self.closed:
|
|
137
139
|
self.last_ping = time.time()
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
|
|
1
4
|
class BaseSocket:
|
|
2
5
|
upgrade_protocols = ['websocket']
|
|
3
6
|
|
|
@@ -5,7 +8,7 @@ class BaseSocket:
|
|
|
5
8
|
self.server = server
|
|
6
9
|
self.sid = sid
|
|
7
10
|
self.queue = self.server.create_queue()
|
|
8
|
-
self.last_ping =
|
|
11
|
+
self.last_ping = time.time()
|
|
9
12
|
self.connected = False
|
|
10
13
|
self.upgrading = False
|
|
11
14
|
self.upgraded = False
|
|
@@ -34,10 +34,11 @@ class Client(base_client.BaseClient):
|
|
|
34
34
|
use. To disable logging set to ``False``. The default is
|
|
35
35
|
``False``. Note that fatal errors are logged even when
|
|
36
36
|
``logger`` is ``False``.
|
|
37
|
-
:param json: An alternative
|
|
37
|
+
:param json: An alternative JSON module to use for encoding and decoding
|
|
38
38
|
packets. Custom json modules must have ``dumps`` and ``loads``
|
|
39
39
|
functions that are compatible with the standard library
|
|
40
|
-
versions.
|
|
40
|
+
versions. This is a process-wide setting, all instantiated
|
|
41
|
+
servers and clients must use the same JSON module.
|
|
41
42
|
:param request_timeout: A timeout in seconds for requests. The default is
|
|
42
43
|
5 seconds.
|
|
43
44
|
:param http_session: an initialized ``requests.Session`` object to be used
|
|
@@ -63,10 +63,11 @@ class Server(base_server.BaseServer):
|
|
|
63
63
|
use. To disable logging set to ``False``. The default is
|
|
64
64
|
``False``. Note that fatal errors are logged even when
|
|
65
65
|
``logger`` is ``False``.
|
|
66
|
-
:param json: An alternative
|
|
67
|
-
packets. Custom
|
|
66
|
+
:param json: An alternative JSON module to use for encoding and decoding
|
|
67
|
+
packets. Custom JSON modules must have ``dumps`` and ``loads``
|
|
68
68
|
functions that are compatible with the standard library
|
|
69
|
-
versions.
|
|
69
|
+
versions. This is a process-wide setting, all instantiated
|
|
70
|
+
servers and clients must use the same JSON module.
|
|
70
71
|
:param async_handlers: If set to ``True``, run message event handlers in
|
|
71
72
|
non-blocking threads. To run handlers synchronously,
|
|
72
73
|
set to ``False``. The default is ``True``.
|
|
@@ -400,7 +401,6 @@ class Server(base_server.BaseServer):
|
|
|
400
401
|
'maxPayload': self.max_http_buffer_size,
|
|
401
402
|
})
|
|
402
403
|
s.send(pkt)
|
|
403
|
-
s.schedule_ping()
|
|
404
404
|
|
|
405
405
|
# NOTE: some sections below are marked as "no cover" to workaround
|
|
406
406
|
# what seems to be a bug in the coverage package. All the lines below
|
|
@@ -412,6 +412,8 @@ class Server(base_server.BaseServer):
|
|
|
412
412
|
self.logger.warning('Application rejected connection')
|
|
413
413
|
return self._unauthorized(ret or None)
|
|
414
414
|
|
|
415
|
+
s.schedule_ping()
|
|
416
|
+
|
|
415
417
|
if transport == 'websocket': # pragma: no cover
|
|
416
418
|
ret = s.handle_get_request(environ, start_response)
|
|
417
419
|
if s.closed and sid in self.sockets:
|
|
@@ -130,10 +130,12 @@ class Socket(base_socket.BaseSocket):
|
|
|
130
130
|
self.queue.join()
|
|
131
131
|
|
|
132
132
|
def schedule_ping(self):
|
|
133
|
-
|
|
133
|
+
# only schedule a new ping if the previous ping wait cycle completed
|
|
134
|
+
if self.last_ping:
|
|
135
|
+
self.last_ping = None
|
|
136
|
+
self.server.start_background_task(self._send_ping)
|
|
134
137
|
|
|
135
138
|
def _send_ping(self):
|
|
136
|
-
self.last_ping = None
|
|
137
139
|
self.server.sleep(self.server.ping_interval)
|
|
138
140
|
if not self.closing and not self.closed:
|
|
139
141
|
self.last_ping = time.time()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-engineio
|
|
3
|
-
Version: 4.13.
|
|
3
|
+
Version: 4.13.2
|
|
4
4
|
Summary: Engine.IO server and client for Python
|
|
5
5
|
Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -18,11 +18,12 @@ Provides-Extra: client
|
|
|
18
18
|
Requires-Dist: requests>=2.21.0; extra == "client"
|
|
19
19
|
Requires-Dist: websocket-client>=0.54.0; extra == "client"
|
|
20
20
|
Provides-Extra: asyncio-client
|
|
21
|
-
Requires-Dist: aiohttp>=3.
|
|
21
|
+
Requires-Dist: aiohttp>=3.11; extra == "asyncio-client"
|
|
22
22
|
Provides-Extra: dev
|
|
23
23
|
Requires-Dist: tox; extra == "dev"
|
|
24
24
|
Provides-Extra: docs
|
|
25
25
|
Requires-Dist: sphinx; extra == "docs"
|
|
26
|
+
Requires-Dist: furo; extra == "docs"
|
|
26
27
|
Dynamic: license-file
|
|
27
28
|
|
|
28
29
|
python-engineio
|
|
@@ -3,14 +3,6 @@ MANIFEST.in
|
|
|
3
3
|
README.md
|
|
4
4
|
pyproject.toml
|
|
5
5
|
tox.ini
|
|
6
|
-
docs/Makefile
|
|
7
|
-
docs/api.rst
|
|
8
|
-
docs/client.rst
|
|
9
|
-
docs/conf.py
|
|
10
|
-
docs/index.rst
|
|
11
|
-
docs/intro.rst
|
|
12
|
-
docs/make.bat
|
|
13
|
-
docs/server.rst
|
|
14
6
|
docs/_static/README.md
|
|
15
7
|
src/engineio/__init__.py
|
|
16
8
|
src/engineio/async_client.py
|
|
@@ -44,7 +36,6 @@ src/python_engineio.egg-info/dependency_links.txt
|
|
|
44
36
|
src/python_engineio.egg-info/not-zip-safe
|
|
45
37
|
src/python_engineio.egg-info/requires.txt
|
|
46
38
|
src/python_engineio.egg-info/top_level.txt
|
|
47
|
-
tests/__init__.py
|
|
48
39
|
tests/async/__init__.py
|
|
49
40
|
tests/async/index.html
|
|
50
41
|
tests/async/test_aiohttp.py
|
{python_engineio-4.13.0 → python_engineio-4.13.2}/src/python_engineio.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_engineio-4.13.0 → python_engineio-4.13.2}/src/python_engineio.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
@@ -95,14 +95,30 @@ class TestSocket:
|
|
|
95
95
|
s = async_socket.AsyncSocket(mock_server, 'sid')
|
|
96
96
|
s.send = mock.AsyncMock()
|
|
97
97
|
|
|
98
|
-
async def
|
|
98
|
+
async def schedule_ping_and_sleep():
|
|
99
99
|
s.schedule_ping()
|
|
100
100
|
await asyncio.sleep(0.05)
|
|
101
101
|
|
|
102
|
-
await
|
|
102
|
+
await schedule_ping_and_sleep()
|
|
103
103
|
assert s.last_ping is not None
|
|
104
104
|
assert s.send.await_args_list[0][0][0].encode() == '2'
|
|
105
105
|
|
|
106
|
+
async def test_schedule_ping_twice(self):
|
|
107
|
+
mock_server = self._get_mock_server()
|
|
108
|
+
mock_server.ping_interval = 0.01
|
|
109
|
+
s = async_socket.AsyncSocket(mock_server, 'sid')
|
|
110
|
+
s.send = mock.AsyncMock()
|
|
111
|
+
|
|
112
|
+
async def schedule_ping_and_sleep():
|
|
113
|
+
s.schedule_ping()
|
|
114
|
+
await asyncio.sleep(0.05)
|
|
115
|
+
|
|
116
|
+
s.schedule_ping()
|
|
117
|
+
assert s.last_ping is None
|
|
118
|
+
await schedule_ping_and_sleep()
|
|
119
|
+
assert s.last_ping is not None
|
|
120
|
+
assert s.send.await_count == 1
|
|
121
|
+
|
|
106
122
|
async def test_schedule_ping_closed_socket(self):
|
|
107
123
|
mock_server = self._get_mock_server()
|
|
108
124
|
mock_server.ping_interval = 0.01
|
|
@@ -21,6 +21,7 @@ class TestSocket:
|
|
|
21
21
|
mock_server.ping_interval_grace_period = 0.001
|
|
22
22
|
mock_server.async_handlers = True
|
|
23
23
|
mock_server.max_http_buffer_size = 128
|
|
24
|
+
mock_server.sleep = time.sleep
|
|
24
25
|
|
|
25
26
|
try:
|
|
26
27
|
import queue
|
|
@@ -104,6 +105,19 @@ class TestSocket:
|
|
|
104
105
|
assert s.last_ping is not None
|
|
105
106
|
assert s.send.call_args_list[0][0][0].encode() == '2'
|
|
106
107
|
|
|
108
|
+
def test_schedule_ping_twice(self):
|
|
109
|
+
mock_server = self._get_mock_server()
|
|
110
|
+
mock_server.ping_interval = 0.1
|
|
111
|
+
s = socket.Socket(mock_server, 'sid')
|
|
112
|
+
s.send = mock.MagicMock()
|
|
113
|
+
s.schedule_ping()
|
|
114
|
+
assert s.last_ping is None
|
|
115
|
+
time.sleep(0.01)
|
|
116
|
+
s.schedule_ping()
|
|
117
|
+
time.sleep(0.1)
|
|
118
|
+
assert s.last_ping is not None
|
|
119
|
+
assert s.send.call_count == 1
|
|
120
|
+
|
|
107
121
|
def test_schedule_ping_closed_socket(self):
|
|
108
122
|
mock_server = self._get_mock_server()
|
|
109
123
|
mock_server.ping_interval = 0.01
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
[tox]
|
|
2
|
-
envlist=flake8,py310,py311,py312,py313,py314,pypy3,docs
|
|
3
|
-
skip_missing_interpreters=True
|
|
4
|
-
|
|
5
|
-
[gh-actions]
|
|
6
|
-
python =
|
|
7
|
-
3.10: py310
|
|
8
|
-
3.11: py311
|
|
9
|
-
3.12: py312
|
|
10
|
-
3.13: py313
|
|
11
|
-
3.14: py314
|
|
12
|
-
pypy-3: pypy3
|
|
13
|
-
|
|
14
1
|
[testenv]
|
|
15
2
|
commands=
|
|
16
3
|
pip install -e .
|
|
@@ -24,8 +11,6 @@ deps=
|
|
|
24
11
|
requests
|
|
25
12
|
websocket-client
|
|
26
13
|
|
|
27
|
-
[testenv:pypy3]
|
|
28
|
-
|
|
29
14
|
[testenv:flake8]
|
|
30
15
|
deps=
|
|
31
16
|
flake8
|
|
@@ -36,6 +21,7 @@ commands=
|
|
|
36
21
|
changedir=docs
|
|
37
22
|
deps=
|
|
38
23
|
sphinx
|
|
24
|
+
furo
|
|
39
25
|
allowlist_externals=
|
|
40
26
|
make
|
|
41
27
|
commands=
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Minimal makefile for Sphinx documentation
|
|
2
|
-
#
|
|
3
|
-
|
|
4
|
-
# You can set these variables from the command line.
|
|
5
|
-
SPHINXOPTS =
|
|
6
|
-
SPHINXBUILD = sphinx-build
|
|
7
|
-
SOURCEDIR = .
|
|
8
|
-
BUILDDIR = _build
|
|
9
|
-
|
|
10
|
-
# Put it first so that "make" without argument is like "make help".
|
|
11
|
-
help:
|
|
12
|
-
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
13
|
-
|
|
14
|
-
.PHONY: help Makefile
|
|
15
|
-
|
|
16
|
-
# Catch-all target: route all unknown targets to Sphinx using the new
|
|
17
|
-
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
|
18
|
-
%: Makefile
|
|
19
|
-
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
API Reference
|
|
2
|
-
=============
|
|
3
|
-
|
|
4
|
-
.. toctree::
|
|
5
|
-
:maxdepth: 3
|
|
6
|
-
|
|
7
|
-
.. module:: engineio
|
|
8
|
-
|
|
9
|
-
.. autoclass:: Client
|
|
10
|
-
:members:
|
|
11
|
-
:inherited-members:
|
|
12
|
-
|
|
13
|
-
.. autoclass:: AsyncClient
|
|
14
|
-
:members:
|
|
15
|
-
:inherited-members:
|
|
16
|
-
|
|
17
|
-
.. autoclass:: Server
|
|
18
|
-
:members:
|
|
19
|
-
:inherited-members:
|
|
20
|
-
|
|
21
|
-
.. autoclass:: AsyncServer
|
|
22
|
-
:members:
|
|
23
|
-
:inherited-members:
|
|
24
|
-
|
|
25
|
-
.. autoclass:: WSGIApp
|
|
26
|
-
:members:
|
|
27
|
-
|
|
28
|
-
.. autoclass:: ASGIApp
|
|
29
|
-
:members:
|
|
30
|
-
|
|
31
|
-
.. autoclass:: Middleware
|
|
32
|
-
:members:
|
|
33
|
-
|