Fix for using external group send.

This commit is contained in:
Bill Schumacher 2019-11-05 09:31:13 -06:00
parent d3630e0925
commit bf1eb6c280
2 changed files with 10 additions and 2 deletions

View File

@ -1 +1 @@
__version__ = "2.3.0" __version__ = "2.3.0a1"

View File

@ -199,7 +199,15 @@ class WebSocketProtocol(WebSocketServerProtocol):
if message.get("bytes", None): if message.get("bytes", None):
self.serverSend(message["bytes"], True) self.serverSend(message["bytes"], True)
if message.get("text", None): if message.get("text", None):
self.serverSend(message["text"], False) # 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): def handle_exception(self, exception):
""" """