Futures

Nabto Edge uses Futures to manage return values and completion of asynchronous API-functions; a future resolves once such function has completed. For more details about this topic, see the Futures Guide.

Futures are introduced to unify the way return values and completion of asynchronous functions are handled and to minimize the number of specialized functions required in the APIs: Instead of having an asynchronous and synchronous version of all functions, the API instead provides a single version returning a future: For asynchronous behavior, a callback can then be configured on the future - for synchronous behavior, the future provides a wait function.

In addition to futures, asynchronous functions that are expected to be invoked recurringly introduces the concept of listeners, also elaborated in the Futures Guide.