Answer the question
In order to leave comments, you need to log in
How to send over a dict channel?
I'm using channels 2.0 (this is important), I have a method in the consumer that sends over a dict channel. BUT, the problem is that it will give me an error when sending "Object of type 'set' is not JSON serializable":
consumer.py:
class ChangesConsumer(JsonWebsocketConsumer):
def connect(self):
async_to_sync(self.channel_layer.group_add)('users', self.channel_name)
self.accept()
def disconnect(self, close_code):
async_to_sync(self.channel_layer.group_discard)('users', self.channel_name)
self.dispatch()
def receive_json(self, content, **kwargs):
self.send_json(content['text'])
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question