LongPollingConfig

fun LongPollingConfig(delayMillis: Long, maxRequestCount: Int? = null, stopOnFirstRequestError: Boolean = false, onTransactionState: (TransactionState) -> Unit, onRequestError: (Exception) -> Unit, onMaxRequestCount: () -> Unit = { })

Parameters

delayMillis

delay between each request

maxRequestCount

maximum number of requests to be sent, null = no limit

stopOnFirstRequestError

stop long polling on first error

onTransactionState

function called every time there is a successful response from server with current TransactionState of transaction

onRequestError

function called when unexpected error occurs (server or client side)

onMaxRequestCount

function called when maxRequestCount is achieved