Just a second...

Pinging Diffusion Cloud

Ping Diffusion™ Cloud from your client. If the ping is successful it reports the round-trip time between your client and Diffusion Cloud .

The Diffusion Cloud client libraries and Diffusion Cloud service include capabilities that automatically check whether the connection is active. However, there might be times when you want to check the connection from within your client code. For example, if the client is aware that the device it is hosted on has recently changed from a 3G connection to a WiFi connection.

Use the pings capability to asynchronously ping Diffusion Cloud .

JavaScript
const pingResult=await session.pingServer();
// Take action based on ping details.

.NET
var pings = session.Ping;
var details = await pings.PingServerAsync();

WriteLine($"Pinged server at {details.Timestamp}. Received answer after {details.RoundTripTimeSpan}.");
Java and Android
final Pings pings = session.feature(Pings.class);
pings.pingServer().thenAccept(pingDetails ->
    System.out.println(pingDetails.getRoundTripTime()));
C
static int on_ping_response(SESSION_T *session, void *context)
{
        // ping response received
        return HANDLER_SUCCESS;
}


void ping(SESSION_T *session)
{
        PING_USER_PARAMS_T params = {
                .on_ping_response = on_ping_response
        };
        ping_user(session, params);
}
Apple
session.pings.pingServer { (ping_details, error) in

    // Check error is `nil`, indicating success.
    if (error != nil) {
        print("An error occurred while pinging the server: %@", error!.localizedDescription)
        return
    }

    print("Ping round trip time: %@", ping_details!.roundTripTime)
}