From dd2c8b2a0f256576ca88db4777885e1c35d75429 Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Thu, 3 May 2018 09:47:12 -0700 Subject: [PATCH] Don't try to send disconnect when we never made an app instance --- daphne/ws_protocol.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daphne/ws_protocol.py b/daphne/ws_protocol.py index 5cb1c65..098c0b2 100755 --- a/daphne/ws_protocol.py +++ b/daphne/ws_protocol.py @@ -142,7 +142,7 @@ class WebSocketProtocol(WebSocketServerProtocol): """ self.server.protocol_disconnected(self) logger.debug("WebSocket closed for %s", self.client_addr) - if not self.muted: + if not self.muted and hasattr(self, "application_queue"): self.application_queue.put_nowait({ "type": "websocket.disconnect", "code": code,