mirror of
https://github.com/django/daphne.git
synced 2025-07-27 15:39:46 +03:00
Fix for using external group send.
This commit is contained in:
parent
d3630e0925
commit
bf1eb6c280
|
@ -1 +1 @@
|
|||
__version__ = "2.3.0"
|
||||
__version__ = "2.3.0a1"
|
||||
|
|
|
@ -199,6 +199,14 @@ class WebSocketProtocol(WebSocketServerProtocol):
|
|||
if message.get("bytes", None):
|
||||
self.serverSend(message["bytes"], True)
|
||||
if message.get("text", None):
|
||||
# When sending a message using:
|
||||
# async_to_sync(channel_layer.group_send)("group1", {"type": "send", "text": "data"})
|
||||
# The below is in error as a dictionary is passed through. But you need to format your request as a
|
||||
# dictionary.
|
||||
# Maybe there's a better way to fix this.
|
||||
if type(message.get("text")) == dict:
|
||||
self.serverSend(message["text"]["text"], False)
|
||||
else:
|
||||
self.serverSend(message["text"], False)
|
||||
|
||||
def handle_exception(self, exception):
|
||||
|
|
Loading…
Reference in New Issue
Block a user