{dialog.object}networkSpeedTest Method


{dialog.object}.networkSpeedTest(packetSize, onComplete, onFail)



The size of the data packet in MB to send to the server. The packet size must include "MB". For example, '1MB'.


The function to call when the client receives a response from the server. The onComplete function takes a single argument, elapse, which is the amount of time (in milliseconds) that has elapsed since the test was initiated.

You will typically define your onComplete event to test the elapsed time. For example, if the elapsed time is below a certain threshold, you can proceed with the synchronization operation. If the elapsed time is above the threshold, you can give the user a message telling them to try again later when the connection is better.


The function to call if the test fails.


Measures the network speed between the server and the device calling the method.


The {dialog.object}.networkSpeedTest() method measures the speed of a network connection by sending a packet of data to the server and measuring how long it takes until a response from the server is received. The primary use case for this method is to determine if the quality of the network connection is sufficient to synchronize data from a mobile application.


var ok = function(elapse) {

    if (elapse < 300) {
        //do the synchronization operation
    } else {
        alert('Connection not good enough. Please try later.');

var fail = function() {
    alert('No connection');