MCPcopy Create free account
hub / github.com/miguelgrinberg/python-socketio / main

Function main

examples/simple-client/async/latency_client.py:6–17  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5
6async def main():
7 async with socketio.AsyncSimpleClient() as sio:
8 await sio.connect('http://localhost:5000')
9 while True:
10 start_timer = time.time()
11 await sio.emit('ping_from_client')
12 while (await sio.receive()) != ['pong_from_server']:
13 pass
14 latency = time.time() - start_timer
15 print(f'latency is {latency * 1000:.2f} ms')
16
17 await asyncio.sleep(1)
18
19
20if __name__ == '__main__':

Callers 1

latency_client.pyFile · 0.70

Calls 4

connectMethod · 0.45
emitMethod · 0.45
receiveMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…