Skip to content

Commit

Permalink
Fix Websockets/Chat: Prefixing Username to Messages Interferes with S…
Browse files Browse the repository at this point in the history
…erver Commands (#634)

Co-authored-by: p3zq <>
  • Loading branch information
p3zq authored Sep 10, 2023
1 parent a4c0cb2 commit 196cb5d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion websockets/chat/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ async def dispatch(ws: aiohttp.ClientWebSocketResponse) -> 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):
Expand Down

0 comments on commit 196cb5d

Please sign in to comment.