getUpdateFlow
Create a Flow based on Long Polling with GetUpdatesApi.
getUpdateFlow(...) { api ->
httpClient.requestData(token, server)
}
Receiver
The HttpClient to call this long polling. It is recommended to configure a larger requestTimeoutMillis
value, at least larger than the milliseconds value corresponding to timeout. Otherwise, an HttpRequestTimeoutException is likely to be thrown. (HttpRequestTimeoutException will be caught by default onError.
Parameters
see GetUpdatesApi.Body.limit. It is recommended to set a larger value, and its millis value should be smaller than the requestTimeoutMillis
of the receiver client.
Handle each API result. Default: { it }
: return itself.
Handle exceptions during API requests. Default: { if (it is HttpRequestTimeoutException) emptyList() else throw it }
: if it is HttpRequestTimeoutException, ignore. Otherwise, throw it.