KtorNSURLSessionDelegate

class KtorNSURLSessionDelegate(challengeHandler: ChallengeHandler?)

A delegate for NSURLSession that bridges it to Ktor. If users set custom session in DarwinClientEngineConfig.sessionAndDelegate, they need to register this delegate in their session. This can be done by registering it directly, extending their custom delegate from it or by calling required methods from their custom delegate.

For HTTP requests to work property, it's important that users call these functions:

  • URLSession:dataTask:didReceiveData:

  • URLSession:task:didCompleteWithError:

  • URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:

For WebSockets to work, it's important that users call these functions:

  • URLSession:webSocketTask:didOpenWithProtocol:

  • URLSession:webSocketTask:didCloseWithCode:reason:

Constructors

Link copied to clipboard
constructor(challengeHandler: ChallengeHandler?)

Functions

Link copied to clipboard
open fun URLSession(session: <Error class: unknown class>, taskIsWaitingForConnectivity: <Error class: unknown class>)
open fun URLSession(session: <Error class: unknown class>, dataTask: <Error class: unknown class>, didReceiveData: <Error class: unknown class>)
open fun URLSession(session: <Error class: unknown class>, task: <Error class: unknown class>, didCompleteWithError: <Error class: unknown class>?)
open fun URLSession(session: <Error class: unknown class>, webSocketTask: <Error class: unknown class>, didOpenWithProtocol: String?)
open fun URLSession(session: <Error class: unknown class>, webSocketTask: <Error class: unknown class>, didCloseWithCode: <Error class: unknown class>, reason: <Error class: unknown class>?)

open fun URLSession(session: <Error class: unknown class>, task: <Error class: unknown class>, didReceiveChallenge: <Error class: unknown class>, completionHandler: (<Error class: unknown class>, <Error class: unknown class>?) -> Unit)

Handle challenge.

open fun URLSession(session: <Error class: unknown class>, task: <Error class: unknown class>, willPerformHTTPRedirection: <Error class: unknown class>, newRequest: <Error class: unknown class>, completionHandler: (<Error class: unknown class>?) -> Unit)

Disable embedded redirects.