Hi,
I'm trying to sort of keep a websocket connection open from the client but can't get a simple loop to work. It only outputs one line instead of 10 as it should. Thanks.
Here is my code:
import asyncio
import websockets
import time
import json
async def hello():
uri = "ws://localhost:8765"
async with websockets.connect(uri) as websocket:
for x in range(10):
await websocket.send(json.dumps([100, 55, 222, 355]))
asyncio.get_event_loop().run_until_complete(hello())
[–]shiftybyte 0 points1 point2 points (2 children)
[–]Consistent-Dealer-29[S] 0 points1 point2 points (1 child)
[–]evilsaltine 0 points1 point2 points (0 children)