code: def receive_message(self, message, data):
          
          if self._socket_client.is_stopped:
              return True
  
          if data[MESSAGE_TYPE] == TYPE_PING:
              try:
                  self._socket_client.send_message(
                      PLATFORM_DESTINATION_ID, self.namespace,
                      {MESSAGE_TYPE: TYPE_PONG}, no_add_request_id=True)
              except PyChromecastStopped:
                  self._socket_client.logger.debug(
                      "Heartbeat error when sending response, "
                      "Chromecast connection has stopped")
  
              return True
  
          elif data[MESSAGE_TYPE] == TYPE_PONG:
              self.reset()
              return True
  
          return False
docs: Called when a heartbeat message is received.