core-jvm
core2-jvm (latest)core-jvm
  • Home
  • Features
  • Examples
  • Spec
  • Guides
  • Sandbox
  • Step Studio
  • Step
    • Action
    • Behavior
    • External
    • Help
    • Link Handler
    • Navigation
    • Persist Async
    • Polling
    • Refresh On Change
    • Step Error
    • Summary
    • Upload
    • Validate Async
    • Schema
    • All Of Schema
    • Array Schema
    • Blob Schema
    • Boolean Schema
    • Const Schema
    • Integer Schema
    • Number Schema
    • Object Schema
    • One Of Schema
    • String Schema
    • Layout
    • Alert Layout
    • Box Layout
    • Button Layout
    • Columns Layout
    • Decision Layout
    • Form Layout
    • Heading Layout
    • Image Layout
    • Instructions Layout
    • List Layout
    • Loading Indicator Layout
    • Markdown Layout
    • Modal Layout
    • Paragraph Layout
    • Review Layout
    • Search Layout
    • Status List Layout
    • Action Response Body
    • Error Response Body
    • Flow Response
    • Search Response Body
    • Search Result
    • Align
    • Autocapitalization Type
    • Autocomplete Token
    • Context
    • Icon
    • Image
    • Size
These docs refer to the older 1.x release of Dynamic Flow.
Go to the latest docs

Polling

Android - 8.25.0 iOS - 11539 Web - 2.5.0

Polling instructs the client to periodically make an HTTP GET request to the specified URL and eventually trigger an action.

Polling is typically used alongside External. For example, a step may first open an external URL and then poll for a server state change. The client may continue to another step or end the flow.

Example

Given the step below, the client will start making requests to the specified URL every 5 seconds.

To progress the flow, the response should be a Flow Response with the `X-DF-Response-Type header set accordingly. Note that older clients only support Action Response Body

To continue Polling, the response should have a 2xx status code and an empty body. The client will continue to make requests until the flow progresses or [maxAttempts] is reached.

Step.build {
    layout { }
    polling {
        url = "https://bar.foo/status?id=12345"
        delay = 5
        timeout = 60
        maxAttempts = 100
        onError {
            action {
                exit = true
                result = encodeToJsonElement(mapOf("exit-action-data" to "EXIT!!!"))
            }
        }
    }
}

Error handling

Given the above step, the action in the onError object is triggered if:

  • the response status code is a failure (>=400).
  • the number of attempts exceeds the specified maxAttempts
  • the response body does not match the X-DF-Response-Type header provided

Properties

PropertyTypeRequiredDescription

delay

Int

Yes

The time in seconds between receiving a response and executing the next request.

Android - 8.73.0 iOS - 12570 Web - 3.16.7

interval

Int

Yes

The time interval between requests, in seconds.

⚠️ Deprecated - Please use delay instead.

maxAttemptsIntYesThe maximum number of requests that may be attempted, before triggering the [onError] action.
onErrorPolling.OnErrorYesAn object with one action property to be triggered when polling fails.

timeout

Int

No

The suggested request timeout in seconds. Typically used when an endpoint is expected to take a long time to respond.

Android - 8.73.0 iOS - 12570 Web - Unsupported

urlStringYesThe URL to open.

Related Types

On Error

Properties

PropertyTypeRequiredDescription
actionActionYesThe Action to be triggered when polling fails.