StreamingNSURLSessionHttpEngine

class StreamingNSURLSessionHttpEngine(timeoutMillis: Long) : HttpEngine

An HttpEngine based on NSURLSession with the ability to stream data as it is received when using Transfer-Encoding: Chunked. This is useful when using @defer.

Note: this implementation only works when using the new native memory manager as multiple threads mutate the internal state.

That is why it is considered experimental and subject to change.

Using the default DefaultHttpEngine will work when using @defer, but the payloads are buffered until the response is fully received, thus losing the incremental nature of the response.

Constructors

StreamingNSURLSessionHttpEngine
Link copied to clipboard
apple
fun StreamingNSURLSessionHttpEngine(timeoutMillis: Long = 60_000)

Functions

dispose
Link copied to clipboard
apple
open override fun dispose()
Disposes any resources used by the HttpEngineUse this to dispose a connection pool for an example.
execute
Link copied to clipboard
apple
open suspend override fun execute(request: <ERROR CLASS>): <ERROR CLASS>
Executes the given HttpRequestthrows ApolloNetworkException if a network error happens HTTP errors should not throw but instead return a HttpResponse indicating the status code