diff --git a/sanic/app.py b/sanic/app.py index 06540088..ca50edc1 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -303,7 +303,8 @@ class Sanic: await fut except (CancelledError, ConnectionClosed): pass - self.websocket_tasks.remove(fut) + finally: + self.websocket_tasks.remove(fut) await ws.close() self.router.add(uri=uri, handler=websocket_handler,