code: def run(self):
          
          while not self.stopped:
              try:
                  # grab a message from queue
                  message = self.gc100_client.queue.get(True, 5)
              except queue.Empty:
                  _LOGGER.debug("message thread: no messages")
                  continue
  
              _LOGGER.debug("message thread: " + str(message))
  
              # parse message
              split_message = str(message).split(',')
              if len(split_message) != 3:
                  _LOGGER.error("can't parse server response")
                  continue
              event, module_address, value = str(message).split(',')
              value = int(value)
  
              # make a copy of the current subscribers to keep this thread-safe
              current_subscribers = dict(self.gc100_client.subscribers)
  
              # send message to subscribers
              for subscriber_id in current_subscribers:
                  # msg or op should match what we asked for
                  subscriber = current_subscribers[subscriber_id]
  
                  if event + "," + module_address == subscriber['event']:
                      subscriber['callback'](value)
                      if subscriber['permanent'] is False:
                          self.gc100_client.unsubscribe(subscriber_id)
  
              # signals to queue job is done
              self.gc100_client.queue.task_done()
docs: Run message thread.