core2-jvm (latest)
core2-jvm (latest)core-jvm
  • Home
  • Features
  • Spec
  • Guides
  • Sandbox
  • Step Studio
  • Step
    • Action
    • External
    • Help
    • Link Handler
    • Navigation
    • Persist Async
    • Polling
    • Refresh On Change
    • Schema On Change
    • Step Error
    • Suggestions
    • Summary
    • Toolbar
    • 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
    • Divider Layout
    • Form Layout
    • Heading Layout
    • Image Layout
    • Instructions Layout
    • List Layout
    • Loading Indicator Layout
    • Markdown Layout
    • Media Layout
    • Modal Layout
    • Paragraph Layout
    • Progress Layout
    • Review Layout
    • Search Layout
    • Section Layout
    • Status List Layout
    • Tabs Layout
    • Upsell Layout
    • Behavior
    • Action Behavior
    • Copy Behavior
    • Dismiss Behavior
    • Link Behavior
    • Modal Behavior
    • Refresh Behavior
    • Subflow Behavior
    • Subflow
    • Dynamic Launch Config
    • Launch Config
    • Modal Presentation
    • Native Launch Config
    • Presentation
    • Push Presentation
    • Action Response Body
    • Error Response Body
    • Flow Response
    • Modal Response Body
    • No Op Response Body
    • Search Initial Layout Config
    • Search Initial Results Config
    • Search Initial State
    • Search Layout Response Body
    • Search Response
    • Search Response Body
    • Search Result
    • Search Results Response Body
    • Subflow Response Body
    • Additional Info
    • Align
    • Autocapitalization Type
    • Autocomplete Token
    • Context
    • Icon
    • Image
    • Inline Alert
    • Media
    • Native Capabilities
    • Request
    • Size
    • Supporting Values
    • Control
    • Tag

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 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.

To stop polling, 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

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

Error handling

Given the above step, the behaviour 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 - 8.72 Web - 3.16.7

intervalIntNo
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 - 8.72 Web - Unsupported

urlStringYesThe URL to open.

Related Types

On Error

Properties

PropertyTypeRequiredDescription

action

Action

No

The Action to be triggered when polling fails.

⚠️ Deprecated - Please use behavior with an action instead.

behavior

Behavior

Yes

The Behavior to be triggered when polling fails.

Android - 8.96.0 iOS - 8.89 Web - 3.34.0