python-engineio 4.9.0__py3-none-any.whl → 4.9.1__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.
@@ -19,7 +19,12 @@ class ASGIApp:
19
19
  :param other_asgi_app: A separate ASGI app that receives all other traffic.
20
20
  :param engineio_path: The endpoint where the Engine.IO application should
21
21
  be installed. The default value is appropriate for
22
- most cases.
22
+ most cases. With a value of ``None``, all incoming
23
+ traffic is directed to the Engine.IO server, with the
24
+ assumption that routing, if necessary, is handled by
25
+ a different layer. When this option is set to
26
+ ``None``, ``static_files`` and ``other_asgi_app`` are
27
+ ignored.
23
28
  :param on_startup: function to be called on application startup; can be
24
29
  coroutine
25
30
  :param on_shutdown: function to be called on application shutdown; can be
@@ -44,24 +49,26 @@ class ASGIApp:
44
49
  self.engineio_server = engineio_server
45
50
  self.other_asgi_app = other_asgi_app
46
51
  self.engineio_path = engineio_path
47
- if not self.engineio_path.startswith('/'):
48
- self.engineio_path = '/' + self.engineio_path
49
- if not self.engineio_path.endswith('/'):
50
- self.engineio_path += '/'
52
+ if self.engineio_path is not None:
53
+ if not self.engineio_path.startswith('/'):
54
+ self.engineio_path = '/' + self.engineio_path
55
+ if not self.engineio_path.endswith('/'):
56
+ self.engineio_path += '/'
51
57
  self.static_files = static_files or {}
52
58
  self.on_startup = on_startup
53
59
  self.on_shutdown = on_shutdown
54
60
 
55
61
  async def __call__(self, scope, receive, send):
56
- if scope['type'] in ['http', 'websocket'] and \
57
- scope['path'].startswith(self.engineio_path):
62
+ if scope['type'] == 'lifespan':
63
+ await self.lifespan(scope, receive, send)
64
+ elif scope['type'] in ['http', 'websocket'] and (
65
+ self.engineio_path is None
66
+ or scope['path'].startswith(self.engineio_path)):
58
67
  await self.engineio_server.handle_request(scope, receive, send)
59
68
  else:
60
69
  static_file = get_static_file(scope['path'], self.static_files) \
61
70
  if scope['type'] == 'http' and self.static_files else None
62
- if scope['type'] == 'lifespan':
63
- await self.lifespan(scope, receive, send)
64
- elif static_file and os.path.exists(static_file['filename']):
71
+ if static_file and os.path.exists(static_file['filename']):
65
72
  await self.serve_static_file(static_file, receive, send)
66
73
  elif self.other_asgi_app is not None:
67
74
  await self.other_asgi_app(scope, receive, send)
engineio/async_server.py CHANGED
@@ -524,9 +524,9 @@ class AsyncServer(base_server.BaseServer):
524
524
  try:
525
525
  await asyncio.wait_for(self.service_task_event.wait(),
526
526
  timeout=self.ping_timeout)
527
- except asyncio.TimeoutError:
528
527
  break
529
- continue
528
+ except asyncio.TimeoutError:
529
+ continue
530
530
 
531
531
  # go through the entire client list in a ping interval cycle
532
532
  sleep_interval = self.ping_timeout / len(self.sockets)
@@ -546,8 +546,9 @@ class AsyncServer(base_server.BaseServer):
546
546
  try:
547
547
  await asyncio.wait_for(self.service_task_event.wait(),
548
548
  timeout=sleep_interval)
549
- except asyncio.TimeoutError:
550
549
  raise KeyboardInterrupt()
550
+ except asyncio.TimeoutError:
551
+ continue
551
552
  except (
552
553
  SystemExit,
553
554
  KeyboardInterrupt,
engineio/client.py CHANGED
@@ -494,7 +494,7 @@ class Client(base_client.BaseClient):
494
494
  p = None
495
495
  try:
496
496
  p = self.ws.recv()
497
- if len(p) == 0: # pragma: no cover
497
+ if len(p) == 0 and not self.ws.connected: # pragma: no cover
498
498
  # websocket client can return an empty string after close
499
499
  raise websocket.WebSocketConnectionClosedException()
500
500
  except websocket.WebSocketTimeoutException:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-engineio
3
- Version: 4.9.0
3
+ Version: 4.9.1
4
4
  Summary: Engine.IO server and client for Python
5
5
  Author-email: Miguel Grinberg <miguel.grinberg@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/miguelgrinberg/python-engineio
@@ -1,11 +1,11 @@
1
1
  engineio/__init__.py,sha256=0R2PY1EXu3sicP7mkA0_QxEVGRlFlgvsxfhByqREE1A,481
2
2
  engineio/async_client.py,sha256=QyHBWpLZxfBc4lK_eodkPM0xzsfVYpt7mzNaA9uG3cg,27932
3
- engineio/async_server.py,sha256=gO7Tq1i4c3rSnN2zQdRrbVZIrPCI9ynjFqsqyIVLP80,25061
3
+ engineio/async_server.py,sha256=dOhDfyPY817RMzEFq9U-IH8e0b7NCEFKTi-c8zb-UCw,25098
4
4
  engineio/async_socket.py,sha256=P8OZW1N5y7jr2hW1qLLK2y_Clt7aHdv2ucYW69mbU4Q,10305
5
5
  engineio/base_client.py,sha256=Q_w0Stvy89wPHwWk7411dRxpGjxNPypm4xy_4XMPZ9M,4872
6
6
  engineio/base_server.py,sha256=Em2RRpbohulKjmYTWHnf_lALKvTT_jHr442Rr2g_BEQ,14013
7
7
  engineio/base_socket.py,sha256=Bw6TWv1pnlXcDdqT59C5CyTaBi7l-_mkykIUuZLjz-g,400
8
- engineio/client.py,sha256=xz1KVYlxjynGUUn6hR_rga1sByYcVdYb5taMVsfXJkk,26291
8
+ engineio/client.py,sha256=79mpLSZT1m-rSu0EcfvOR6TtJbJ6ncCsO0nF7l7WW9A,26317
9
9
  engineio/exceptions.py,sha256=FyuMb5qhX9CUYP3fEoe1m-faU96ApdQTSbblaaoo8LA,292
10
10
  engineio/json.py,sha256=SG5FTojqd1ix6u0dKXJsZVqqdYioZLO4S2GPL7BKl3U,405
11
11
  engineio/middleware.py,sha256=BF_qHAIZZnIbfiP256SD1CX3kzNWbSuto1cpih8oIFg,3766
@@ -17,15 +17,15 @@ engineio/static_files.py,sha256=pwez9LQFaSQXMbtI0vLyD6UDiokQ4rNfmRYgVLKOthc,2064
17
17
  engineio/async_drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  engineio/async_drivers/_websocket_wsgi.py,sha256=FGoRBGOUsEtlfklYNylR0o3oLOGmXIR8QzaCsGLgr3I,949
19
19
  engineio/async_drivers/aiohttp.py,sha256=zJdujjO6dSL_oKDDr4xfO4ID_Vd8faEp1AOIW4ogKME,3768
20
- engineio/async_drivers/asgi.py,sha256=AVEXVP4KLu0etH2kTiuJgVTUkstdNHh0srQSxXx3sBM,10354
20
+ engineio/async_drivers/asgi.py,sha256=CZ_XOiI83vXm_p6_6VqaxocwvgVAUhphtAsZaIyI3_E,10837
21
21
  engineio/async_drivers/eventlet.py,sha256=IG6oLaWH663dw5CEnO-SRz6IsJb6lO55kRCYTdmqZE0,1755
22
22
  engineio/async_drivers/gevent.py,sha256=hnJHeWdDQE2jfoLCP5DnwVPzsQlcTLJUMA5EVf1UL-k,2962
23
23
  engineio/async_drivers/gevent_uwsgi.py,sha256=cnjCsnDHTa6rKgwDKD6rLvIw1Yun-g4c1QbujOC_bMY,5962
24
24
  engineio/async_drivers/sanic.py,sha256=SY0HIp5DUHF7B55tJCBB_8qDjrRTD_FyNQ2cIwRIGR8,4538
25
25
  engineio/async_drivers/threading.py,sha256=ywmG59d4H6OHZjKarBN97-9BHEsRxFEz9YN-E9QAu_I,463
26
26
  engineio/async_drivers/tornado.py,sha256=9bB7FvY47Snx_h4rsNwRk5wIINf2ju7hXWTAqF3intA,5909
27
- python_engineio-4.9.0.dist-info/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
28
- python_engineio-4.9.0.dist-info/METADATA,sha256=Qb43yDoGFRx78nu3tWw4hLWtPAt3bU-44hLJV-4P8DA,2244
29
- python_engineio-4.9.0.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
30
- python_engineio-4.9.0.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
31
- python_engineio-4.9.0.dist-info/RECORD,,
27
+ python_engineio-4.9.1.dist-info/LICENSE,sha256=yel9Pbwfu82094CLKCzWRtuIev9PUxP-a76NTDFAWpw,1082
28
+ python_engineio-4.9.1.dist-info/METADATA,sha256=MNHZzYM4BsSNebhsXVslP-kaHg08S74pkLABnPxDRYw,2244
29
+ python_engineio-4.9.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
30
+ python_engineio-4.9.1.dist-info/top_level.txt,sha256=u8PmNisCZLwRYcWrNLe9wutQ2tt4zNi8IH362c-HWuA,9
31
+ python_engineio-4.9.1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.42.0)
2
+ Generator: bdist_wheel (0.43.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5