Search code examples
djangopython-3.xdjango-channels

Django Channels: Could I know who is the sender of a message?


I'm using Django channels 2.1.1

So, this is my logic, one Websocket instance is getting messages of the same type "alarm.data" from 2 differents groups. One group "alarms" and another groupr "alarms_specific_for_user_IDUSER"

Could I know where they come from whitout adding a "tag" in the text message?


Solution

  • No you will need to put it into the message from the self.scope['user'] property from the Channel that created the message.