MCPcopy Create free account
hub / github.com/actix/examples / stdin_callback

Function stdin_callback

websockets/chat-tcp/client.py:18–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

16 ws = await aiohttp.ClientSession().ws_connect(url, autoclose=False, autoping=False)
17
18 def stdin_callback():
19 line = sys.stdin.buffer.readline().decode('utf-8')
20 if not line:
21 loop.stop()
22 else:
23 # Queue.put is a coroutine, so you can't call it directly.
24 asyncio.ensure_future(queue.put(ws.send_str(name + ': ' + line)))
25
26 loop.add_reader(sys.stdin, stdin_callback)
27

Callers

nothing calls this directly

Calls 2

decodeMethod · 0.80
stopMethod · 0.80

Tested by

no test coverage detected