PollingCollector

A collector that handles asynchronous polling operations in DaVinci authentication flows.

The PollingCollector is used for authentication scenarios that require waiting for user actions on another device or channel, such as:

  • Push notification authentication

  • QR code scanning

  • Email verification

  • Out-of-band (OOB) authentication

Polling Modes

Simple Polling Mode

When pollChallengeStatus is false or challenge is empty, performs a simple delay-based polling without actively checking server status. After each delay:

This mode is useful for basic waiting periods where the client simply needs to wait before checking again.

Challenge Status Polling Mode

When pollChallengeStatus is true and challenge is not empty, actively polls a server endpoint to check the status of an authentication challenge. The polling continues until:

Polling Endpoint: {baseUrl}/davinci/user/credentials/challenge/{challenge}/status

Flow-based API

The pollStatus method returns a Flow that emits PollingStatus updates throughout the polling lifecycle, providing real-time feedback to the application for UI updates.

Flow Interception: The flow automatically intercepts each emission using onEach to set the value property before the caller receives it. This ensures value is always synchronized with the emitted status.

## Value Assignment

The [value] property is automatically set via flow interception based on the polling outcome:
- [PollingStatus.Complete] → Server status value (e.g., "approved")
- [PollingStatus.TimedOut] → "timedOut"
- [PollingStatus.Expired] → "expired"
- [PollingStatus.Error] → "error"
- [PollingStatus.Continue] → "continue"

This value is submitted as part of the form data when continuing to the next node in the flow.

@see PollingStatus
@see poll

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
lateinit var challenge: String

The challenge identifier to poll for. Used to construct the polling endpoint URL.

Link copied to clipboard
open lateinit override var continueNode: ContinueNode

The continue node for the DaVinci flow. Used to extract configuration and context for the polling operation.

Link copied to clipboard
open lateinit override var davinci: <Error class: unknown class>

The DaVinci workflow instance. Provides access to HTTP client and logger for polling operations.

Link copied to clipboard

Whether to actively poll for challenge status. When false, performs simple delay polling. When true, polls the server endpoint for challenge completion.

Link copied to clipboard
lateinit var pollInterval: String

Polling interval in milliseconds between each polling attempt. Default value is "2000" (2 seconds).

Link copied to clipboard
lateinit var pollRetries: String

Maximum number of polling attempts before timing out. Default value is "60".

Link copied to clipboard

The number of polling attempts remaining before timeout in simple polling mode.

Functions

Link copied to clipboard
open override fun close()

Clears the collector's value property.

Link copied to clipboard
open override fun eventType(): String
Link copied to clipboard
open override fun init(input: JsonObject): PollingCollector

Initializes the PollingCollector with configuration from the input JSON.

Link copied to clipboard

Polls for the challenge status and emits the current polling status.