Update the handler to close the connection if empty data.
This commit is contained in:
@@ -58,10 +58,16 @@ class ProducerClient:
|
|||||||
message = input('message: ')
|
message = input('message: ')
|
||||||
await self.send_notification(title, 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:
|
except asyncio.CancelledError:
|
||||||
pass
|
pass
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("\nbye")
|
print("\nbye")
|
||||||
|
await self.send_notification('', '')
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
finally:
|
finally:
|
||||||
self.writer.close()
|
self.writer.close()
|
||||||
|
|||||||
Reference in New Issue
Block a user