2 Replies Latest reply on Aug 20, 2008 3:19 PM by tforster

    URLMonitor and a local server?

    iamscottwalter
      Hi,

      I am playing around with the URLMonitor. I have a local application server running and inside my air app I do this:

      var monitor = new air.URLMonitor(" http://localhost:8080/siteproducer");
      monitor.addEventListener(air.StatusEvent.STATUS, announceStatus);
      monitor.start();

      function announceStatus(e) {
      alert(monitor.available);
      }

      However if I shutdown my local app server I do not get notified. I get notified the first time when the air app starts but if I shutdown the local app server after the air app starts I do not get notified.

      Any thoughts? Is it because its a local url?

      thanks,

      scott.
        • 1. Re: URLMonitor and a local server?
          enorton@adobe Level 1
          Hi Scott,

          The monitor will be triggered if there is a change in your computer's network access. To make it check more often add

          monitor.pollInterval = someIntervalInMilliseconds;

          -Erica
          • 2. Re: URLMonitor and a local server?
            tforster
            Erica, I an experiencing the same behaviour as Scott. I have tried setting the pollInterval but it doesn't seem to make a difference. When my app is ready it will be checking on the availability of remote URLs so this isn't a huge problem. However, for testing purposes it would still be great to have web server instances on my development box which is a lone laptop that is often disconnected from the Internet.

            Could you provide some insight into how the servicemonitor class works? And specifically the URLMonitor? Ultimately I want to be able to monitor the users machine running the AIR app. If URLMonitor is triggered by changes in the actual network connectivity I would rather raise events on that than a remote URL which has the potential to go down, even though the network connection is still good.

            Thank you

            Troy