Adobe Integrated Runtime (AIR) for JavaScript Developers Pocket Reference

(nextflipdebug5) #1
Service and Server Monitoring | 101

</head>
<body onload="doLoad( )">

<input id="btnBrowse" type="button" value="Browse" />

</body>
</html>

Service and Server Monitoring


Monitoring Connectivity to an HTTP Server


Problem


Your application needs to monitor and determine whether a
specific HTTP server can be reached.


Solution


Use theURLMonitorclass to detect network state changes in
HTTP/S endpoints.


Discussion


Service monitor classes work through event notification and
subsequent polling of the designated endpoint. Service moni-
toring is not part of the Adobe Integrated Runtime (AIR)
directly, and needs to be added before it can be used.


The classes for service monitoring are contained in the
servicemonitor.swffile which can be found in the “frame-
works” directory of the AIR SDK. This file should be copied
into the application project folder, and can be included
through the use of the HTML SCRIPT tag. The
servicemonitor.swffile also needs to be included in the pack-
aged AIR application.


<script src="servicemonitor.swf"></script>

TheURLMonitorclass takes a single argument in the construc-
tor, an instance of theURLRequest class. TheURLRequest

Free download pdf