MCPcopy Index your code
hub / github.com/python-websockets/websockets / client

Function client

experiments/compression/client.py:19–45  ·  view source on GitHub ↗
(num)

Source from the content-addressed store, hash-verified

17
18
19async def client(num):
20 # Space out connections to make them sequential.
21 await asyncio.sleep(num * INTERVAL)
22
23 tracemalloc.start()
24
25 async with connect(
26 "ws://localhost:8765",
27 extensions=[
28 ClientPerMessageDeflateFactory(
29 server_max_window_bits=WB,
30 client_max_window_bits=WB,
31 compress_settings={"memLevel": ML},
32 )
33 ],
34 ) as ws:
35 await ws.send("hello")
36 await ws.recv()
37
38 await ws.send(b"hello")
39 await ws.recv()
40
41 MEM_SIZE.append(tracemalloc.get_traced_memory()[0])
42 tracemalloc.stop()
43
44 # Hold connection open until the end of the test.
45 await asyncio.sleep((CLIENTS + 1 - num) * INTERVAL)
46
47
48async def clients():

Callers 1

clientsFunction · 0.70

Calls 5

connectFunction · 0.90
appendMethod · 0.80
sendMethod · 0.45
recvMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…