cv-frames 0.0.2__tar.gz → 0.0.3__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.
- {cv_frames-0.0.2 → cv_frames-0.0.3}/PKG-INFO +1 -1
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/PKG-INFO +1 -1
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/iterate.py +1 -1
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/web/server.py +11 -9
- {cv_frames-0.0.2 → cv_frames-0.0.3}/.github/workflows/publish.yml +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/.github/workflows/tests.yml +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/.gitignore +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/.pre-commit-config.yaml +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/README.rst +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/SOURCES.txt +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/dependency_links.txt +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/entry_points.txt +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/requires.txt +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cv_frames.egg-info/top_level.txt +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/__init__.py +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/cli.py +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/web/__init__.py +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/web/client.py +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/cvframes/web/static/index.html +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/pyproject.toml +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/requirements.txt +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/setup.cfg +0 -0
- {cv_frames-0.0.2 → cv_frames-0.0.3}/tests/test_iterate.py +0 -0
|
@@ -33,14 +33,20 @@ async def broadcast_task(
|
|
|
33
33
|
frame = await frame_queue.get()
|
|
34
34
|
async with clients_lock:
|
|
35
35
|
to_remove = set()
|
|
36
|
+
tasks = []
|
|
36
37
|
for ws in clients:
|
|
37
38
|
if ws.closed:
|
|
38
39
|
to_remove.add(ws)
|
|
39
40
|
continue
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
|
|
42
|
+
async def send(ws):
|
|
43
|
+
try:
|
|
44
|
+
await ws.send_bytes(frame)
|
|
45
|
+
except Exception:
|
|
46
|
+
to_remove.add(ws)
|
|
47
|
+
|
|
48
|
+
tasks.append(asyncio.create_task(send(ws)))
|
|
49
|
+
await asyncio.gather(*tasks, return_exceptions=True)
|
|
44
50
|
for ws in to_remove:
|
|
45
51
|
clients.remove(ws)
|
|
46
52
|
frame_queue.task_done()
|
|
@@ -135,7 +141,6 @@ async def websocket_handler(request):
|
|
|
135
141
|
|
|
136
142
|
async def main(http_port: int, tcp_port: int):
|
|
137
143
|
app = web.Application()
|
|
138
|
-
|
|
139
144
|
frame_queue: asyncio.Queue = asyncio.Queue()
|
|
140
145
|
clients: set[web.WebSocketResponse] = set()
|
|
141
146
|
clients_lock = asyncio.Lock()
|
|
@@ -150,11 +155,8 @@ async def main(http_port: int, tcp_port: int):
|
|
|
150
155
|
|
|
151
156
|
# Get static paths relative to package
|
|
152
157
|
index = pkg_resources.files("cvframes.web.static").joinpath("index.html")
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
app.router.add_get("/", lambda request: web.FileResponse(index))
|
|
158
|
+
app.router.add_get("/", lambda request: web.FileResponse(str(index)))
|
|
156
159
|
app.router.add_get("/ws", websocket_handler)
|
|
157
|
-
app.router.add_static("/static/", path=static, name="static")
|
|
158
160
|
|
|
159
161
|
runner = web.AppRunner(app)
|
|
160
162
|
await runner.setup()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|