Documentation

The Akula Server supports both synchronous and asynchronous requests for all clients except JavaScript. The JavaScript client only supports asynchronous requests. A best practice is to use asynchronous requests because the app can continue executing after an asynchronous request. Synchronous requests should only be used when you want to manage your own threads.

An asynchronous request uses callback methods, where the app invokes a callback method when the Akula Server responds to the request. The callback methods can handle a successful request and a request failure, as the following example shows for a log in:

A synchronous request waits for the Akula Server to return a response before the app continues. Typically, you make a synchronous request in a try/catch block, as the following example shows:

If the loginSync() method fails, it throws an AKException object that you can catch and handle appropriately for your app.

Note that in the Android client SDK, the synchronous form of a method contains "Sync" in the method signature. 

In the iOS client SDK, the synchronous form of a method takes an NSError object as an argument, and the method has the form login:withCredentials:error:. The asynchronous form takes a delegate argument and has the form login:withCredentials:delegate:. For examples using asynchronous and synchronous methods in iOS, see Authenticating Users.