()
| 25 | |
| 26 | |
| 27 | async def client(): |
| 28 | try: |
| 29 | async with connect( |
| 30 | "ws://localhost:8765", |
| 31 | ping_timeout=None, |
| 32 | ) as websocket: |
| 33 | async for msg in websocket: |
| 34 | client_time = time.time_ns() |
| 35 | server_time = int(msg[:19].decode()) |
| 36 | LATENCIES[websocket] = client_time - server_time |
| 37 | except Exception as exc: |
| 38 | print(exc) |
| 39 | |
| 40 | |
| 41 | async def main(count, interval): |