code: def queue_poll(self, sleep_t=0.5):
          
          connection_alive = True
  
          while self.running:
              if self.ws:
                  def logger_and_close(msg):
                      self.log.error('Websocket exception', exc_info=True)
                      if not self.running:
                          # Tear down has been invoked
                          # Prepare to exit the program
                          connection_alive = False  # noqa: F841
                      else:
                          if not self.number_try_connection:
                              # Stop everything.
                              self.teardown()
                              self._display_ws_warning()
  
                  with catch(websocket.WebSocketException, logger_and_close):
                      result = self.ws.recv()
                      self.queue.put(result)
  
              if connection_alive:
                  time.sleep(sleep_t)
docs: Put new messages on the queue as they arrive. Blocking in a thread.
  
          Value of sleep is low to improve responsiveness.