asyncio: correct shutdown does not work
📁 Advanced Python Topics, question, Error, example, python3, asyncio, web, AI, game
I'm having the same problem again. Previously, all tanks were under my control, and I could manually close them. But the trouble is: I needed websockets here. In the examples, proper shutdown is not implemented:
start_server = websockets.serve(hello, 'localhost', 8765) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever()
I played with examples, and yes, with Ctrl+C, it crashes if there is a connected client:
$ python websocket_server.py ^CKeyboardInterruptException ignored in: Task was destroyed but it No answers yet.
Log in to leave an answer
Blogs
Algorithms and Data Structures in Go: A Complete Guide for Beginners
HTTP Client in TypeScript: Making Requests the Right Way
Rust in 2025: What's New for Beginner Developers
Working with JSON in Swift: Parsing and Serialization in Practice