async

abstract override fun async(callback: Consumer<Result<Output>>)

Run the action asynchronously, without blocking the calling thread and delivering the result through the callback.

The delivered result can be either a success (including a result value if any) or a failure (including a PubNubException).

The recommended pattern to use is:

action.async { result ->
result.onSuccess { value ->
// do something with value
}.onFailure { exception ->
// do something with exception
}
}