02-01-2020 06:14 PM - edited 23-07-2020 09:00 AM
Each of the GraphQL endpoints, to query the repository, can return results in synchronous or asynchronous way.
To avoid confusion, it is important to make the difference between :
There are in fact 2 possibles cases :
The first case : is particularly useful to get immediate results when calling the API. The drawback is that if it takes time to get a result, the caller is hanging and wait for the response. In case of response taking several seconds, timeout may occur on the network or web browser.
The second case : is particularly useful for requests that are time consuming to compute. A first call is made to the API. This call returns a x-hopex-task and a x-hopex-sessiontoken. The status code of the response will be HTTP 206 Partial response. This information is then used to recall, in a pooling mechanism, the same endpoint until it returns 200 success.
The mechanism for asynchronous call is web pooling. As of now we do not provide any webhook mechanism.
Regardless of the endpoint called (sync or async) each programming language has its own way to make an HTTP request.
Then HTTP request can be made via a synchronous or asynchronous call. For instance, the programming can be "stuck" and wait for the response before to proceed to the next step of the programming; or the programming can "continue" and get triggered when the response is available.
As a result you can end up in the following situation :
In fact it depends on the use case. Is it a web application ? Is it a mobile app ? What is the quality of the network ? What are timeout options ?
Asynchronous are better when the system can deal with the response at a later stage : web application, mobile app for instance.
Synchronous are better when the system needs the information to proceed to the next steps : integration with other systems for instance.