mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 10:30:17 +01:00
Tests sur l'implémentation de communication interface web / backend python pour la reconnaissance de main avec webSocket
13 lines
464 B
Python
13 lines
464 B
Python
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() |