624 Part IV: Appendixes
MethodDescriptionExamplecollect(url)Sends the communication statistics collected to the specified URL as a JSON packet using a POST request made upon page unload. The JSON object contains totalRequests,totalTimeouts,totalRetries,
totalSuccesses,totalFails, andrequestFails. The
requestFailsis an array of objectswhere the object contains theurl, thestatus(the HTTP status), andmessage(contains any error message).AjaxTCR.comm.stats.collect("collectStats.php");get()Returns the object that is storing the statistics. The JSON object contains totalRequests,totalTimeouts,totalRetries,
totalSuccesses,totalFails, andrequestFails. The
requestFailsis an array of objectswhere the object contains theurl, thestatus(the HTTP status), andmessage(contains any error message). Note that it will contain only values up until the time called, and any values sent by collect may include subsequent request data.var statusReport = AjaxTCR.comm.stats.get();getRequestCount(type)Returns the number of requests. The typedefaults to “all”, which includesactive requests and queued requests. The other options are “active” and“queued”.var total = AjaxTCR.comm.stats.getRequestCount();var waiting = AjaxTCR.comm.stats.getRequestCount("queued");T
ABLEC-7Communication Statistics Management Methods