mirror of
https://git.roussel.pro/telecom-paris/pact.git
synced 2026-02-09 10:30:17 +01:00
14 lines
459 B
Python
14 lines
459 B
Python
import asyncio
|
|
import json
|
|
import websockets
|
|
|
|
# create handler for each connection
|
|
async def handler(websocket):
|
|
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() |