code: def on_leave(self):
          ''' Quit chat room '''
          # Only if user has time to call self.initialize
          # (sometimes it's not the case)
          if self.roomId != '-1':
              # Debug
              logging.debug('chat: leave room (roomId: %s)' % self.roomId)
  
              # Say to other users the current user leave room
              self.publishToOther(self.roomId, 'leave', {
                  'username': self.username
              })
  
              # Remove sockjsroom link to this room
              self.leave(self.roomId)
  
          # Erasing data
          self.initialize(f on_leave(self):
          ''' Quit chat room '''
          # Only if user has time to call self.initialize
          # (sometimes it's not the case)
          if self.roomId != '-1':
              # Debug
              logging.debug('chat: leave room (roomId: %s)' % self.roomId)
  
              # Say to other users the current user leave room
              self.publishToOther(self.roomId, 'leave', {
                  'username': self.username
              })
  
              # Remove sockjsroom link to this room
              self.leave(self.roomId)
  
          # Erasing data
          self.initialize()
docs: Quit chat room