mirror of
https://github.com/actix/examples
synced 2024-11-23 14:31:07 +01:00
Fix Websockets/Chat: Prefixing Username to Messages Interferes with Server Commands (#634)
Co-authored-by: p3zq <>
This commit is contained in:
parent
a4c0cb22a9
commit
196cb5d8b8
@ -41,7 +41,10 @@ async def start_client(url: str) -> None:
|
||||
|
||||
# Exit with Ctrl+D
|
||||
while line := await asyncio.to_thread(sys.stdin.readline):
|
||||
await ws.send_str(name + ": " + line)
|
||||
if line.startswith("/"):
|
||||
await ws.send_str(line)
|
||||
else:
|
||||
await ws.send_str(name + ": " + line)
|
||||
|
||||
dispatch_task.cancel()
|
||||
with suppress(asyncio.CancelledError):
|
||||
|
Loading…
Reference in New Issue
Block a user