Update the handler to close the connection if empty data.
This commit is contained in:
@@ -58,10 +58,16 @@ class ProducerClient:
|
||||
message = input('message: ')
|
||||
await self.send_notification(title, message)
|
||||
|
||||
if title == '' and message == '':
|
||||
self.console.print(f"[yellow b][INFO][/] Finished.")
|
||||
self.console.print("[green]bye[/]")
|
||||
break
|
||||
|
||||
except asyncio.CancelledError:
|
||||
pass
|
||||
except KeyboardInterrupt:
|
||||
print("\nbye")
|
||||
await self.send_notification('', '')
|
||||
sys.exit(0)
|
||||
finally:
|
||||
self.writer.close()
|
||||
|
||||
Reference in New Issue
Block a user