code: def run(self):
          
          try:
              self.initialize_connection()
          except ChromecastConnectionError:
              self._report_connection_status(
                  ConnectionStatus(CONNECTION_STATUS_DISCONNECTED,
                                   NetworkAddress(self.host, self.port)))
              return
  
          self.heartbeat_controller.reset()
          self._force_recon = False
          logging.debug("Thread started...")
          while not self.stop.is_set():
  
              if self.run_once() == 1:
                  break
  
          # Clean up
          self._cleanup()
docs: Connect to the cast and start polling the socket.