title: Django channels username sender
body: <p>I am new to Django channels , i followed the documentation tutorial and i made a Django chat room , so far i can send and recieve messages , but the probleme here the sender is unknown , i tried to send the username but  its not working , i get the username printed in the server but in the front i get the actual login username?? i am confused  ?</p>
  <p>consumer.py :</p>
  <pre><code>class ChatConsumer(AsyncWebsocketConsumer):
      async def connect(self):
          self.room_name = self.scope['url_route']['kwargs']['room_name']
          self.room_group_name = 'chat_%s' % self.room_name
          self.user = self.scope[&quot;user&quot;]
          # Join room group
          await self.channel_layer.group_add(
              self.room_group_name,
              self.channel_name
          )
  
          await self.accept()
  
      async def disconnect(self, close_code):
          # Leave room group
          await self.channel_layer.group_discard(
              self.room_group_name,
              self.channel_name
          )
  
      # Receive message from WebSocket
      async def receive(self, text_data):
          text_data_json = json.loads(text_data)
          message = text_data_json['message']
  
          # Send message to room group
          await self.channel_layer.group_send(
              self.room_group_name,
              {
                  'type': 'chat_message',
                  'message': message
              }
          )
  
      # Receive message from room group
      async def chat_message(self, event):
          message = event['message']
          print(self.user.username)
  
          # Send message to WebSocket
          await self.send(text_data=json.dumps({
              'message': message,
              'username' : str(self.user.username),
          }))
  
  </code></pre>
  <p>room.html :</p>
  <pre><code>&lt;!-- chat/templates/chat/room.html --&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;/&gt;
      &lt;title&gt;Chat Room&lt;/title&gt;
  
  &lt;script src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js&quot;&gt;&lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;div style=&quot;width:800px; margin:0 auto;&quot;&gt;username :
       &lt;a  id=&quot;username&quot; href=&quot;&quot;&gt;{{ user.get_username }}&lt;/a&gt;
       &lt;textarea id=&quot;chat-log&quot; cols=&quot;100&quot; rows=&quot;20&quot;&gt;&lt;/textarea&gt;&lt;br/&gt;
      &lt;input id=&quot;chat-message-input&quot; type=&quot;text&quot; size=&quot;75&quot;/&gt;&lt;br/&gt;
      &lt;input id=&quot;chat-message-submit&quot; type=&quot;button&quot; value=&quot;Send&quot;/&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;script&gt;
      var roomName = {{ room_name_json }};
  
      var chatSocket = new WebSocket(
          'ws://' + window.location.host +
          '/ws/chat/' + roomName + '/');
  
      chatSocket.onmessage = function(e) {
          var data = JSON.parse(e.data);
          var message = data['message'];
          console.log(e.data)
  
          document.querySelector('#chat-log').value += ( message + '\n');
      };
  
      chatSocket.onclose = function(e) {
          console.error('Chat socket closed unexpectedly');
      };
  
      document.querySelector('#chat-message-input').focus();
      document.querySelector('#chat-message-input').onkeyup = function(e) {
          if (e.keyCode === 13) {  // enter, return
              document.querySelector('#chat-message-submit').click();
          }
      };
  
      document.querySelector('#chat-message-submit').onclick = function(e) {
          var messageInputDom = document.querySelector('#chat-message-input');
          var message = messageInputDom.value;
          chatSocket.send(JSON.stringify({
              'message': message
          }));
  
          messageInputDom.value = '';
      };
  &lt;/script&gt;
  &lt;/html&gt;
  
  </code></pre>