MCPcopy Create free account
hub / github.com/0x676e67/wreq-python / receive_message

Function receive_message

python/examples/ws.py:14–29  ·  view source on GitHub ↗
(ws)

Source from the content-addressed store, hash-verified

12
13
14async def receive_message(ws):
15 # while True:
16 # try:
17 # message = await ws.recv()
18 # print("Received: ", message)
19 # if message.data == b"Message 20":
20 # print("Closing connection...")
21 # break
22 # except asyncio.CancelledError:
23 # break
24 # or
25 async for message in ws:
26 print("Received: ", message)
27 if message.data == b"Message 20":
28 print("Closing connection...")
29 break
30
31
32async def main():

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected