From 25626fa3bf8c6f4f773e0bef2e0e254918d0641a Mon Sep 17 00:00:00 2001 From: Andrew Godwin Date: Sun, 20 Mar 2016 12:29:04 -0300 Subject: [PATCH] Update daphne to new asgi spec --- daphne/ws_protocol.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daphne/ws_protocol.py b/daphne/ws_protocol.py index 8d10f0f..ec30799 100755 --- a/daphne/ws_protocol.py +++ b/daphne/ws_protocol.py @@ -39,8 +39,9 @@ class WebSocketProtocol(WebSocketServerProtocol): # Tell main factory about it self.main_factory.reply_protocols[self.reply_channel] = self # Make initial request info dict from request (we only have it here) + self.path = request.path.encode("ascii") self.request_info = { - "path": request.path.encode("ascii"), + "path": self.path, "headers": clean_headers, "query_string": query_string, "client": [self.transport.getPeer().host, self.transport.getPeer().port], @@ -69,12 +70,14 @@ class WebSocketProtocol(WebSocketServerProtocol): if isBinary: self.channel_layer.send("websocket.receive", { "reply_channel": self.reply_channel, + "path": self.path, "order": self.packets_received, "bytes": payload, }) else: self.channel_layer.send("websocket.receive", { "reply_channel": self.reply_channel, + "path": self.path, "order": self.packets_received, "text": payload.decode("utf8"), }) @@ -101,6 +104,7 @@ class WebSocketProtocol(WebSocketServerProtocol): del self.factory.reply_protocols[self.reply_channel] self.channel_layer.send("websocket.disconnect", { "reply_channel": self.reply_channel, + "path": self.path, "order": self.packets_received + 1, }) self.factory.log_action("websocket", "disconnected", {