diff --git a/sanic/server.py b/sanic/server.py index a475fd98..0efcfd05 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -635,7 +635,7 @@ def serve(host, port, request_handler, error_handler, before_start=None, coros = [] for conn in connections: if hasattr(conn, "websocket") and conn.websocket: - coros.append(conn.websocket.close_connection(force=True)) + coros.append(conn.websocket.close_connection(after_handshake=True)) else: conn.close() diff --git a/sanic/worker.py b/sanic/worker.py index 79c0a17d..6de18159 100644 --- a/sanic/worker.py +++ b/sanic/worker.py @@ -115,7 +115,7 @@ class GunicornWorker(base.Worker): coros = [] for conn in self.connections: if hasattr(conn, "websocket") and conn.websocket: - coros.append(conn.websocket.close_connection(force=True)) + coros.append(conn.websocket.close_connection(after_handshake=False)) else: conn.close() _shutdown = asyncio.gather(*coros, loop=self.loop)