effets sur l'interface web depuis python

Tests sur l'implémentation de communication interface web / backend python pour la reconnaissance de main avec webSocket
This commit is contained in:
2023-01-05 17:08:01 +01:00
parent 5c15a2837a
commit d7893c91ad
9 changed files with 119 additions and 72 deletions

View File

@@ -0,0 +1,13 @@
import asyncio
import json
import websockets
# create handler for each connection
async def handler(websocket, path):
data = await websocket.recv()
print(data)
await websocket.send(json.dumps({"type": "effects", "effects": [{"type": "thumbs_up", "x":13, "y": 30, "width": 50, "height": 50}]}))
start_server = websockets.serve(handler, "localhost", 5000)
asyncio.get_event_loop().run_until_complete(start_server)
asyncio.get_event_loop().run_forever()