I am using channels 2.x (along with nginx, daphne, redis and
gunicorn)
In the local console I can see the user data I added in the chat consumer but not in my production
environment
(in production everything else works, but the user is undefined. Note: the user is logged in.
Does anyone have any idea why that might be?
I followed the doc tutorial and the only thing i added was the line commented below
class ChatConsumer(WebsocketConsumer):
def chat_message(self, event):
message = event['message']
# Send message to WebSocket
self.send(text_data=json.dumps({ 'user': self.scope["user"].first_name, # <<< this is the line I added
'message': message
}))
Thanks,
Adam