Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSURLSessionMBS class.
NSURLSessionMBS.streamTaskBetterRouteDiscoveredForStreamTask(streamTask as NSURLSessionStreamTaskMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
streamTask: The stream task that discovered a better route.
This method is called when the URL loading system determines that a better route to the endpoint host is available. For example, this method may be called when a Wi-Fi interface becomes available.
You should consider completing pending work and creating a new stream task in order to take advantage of better routes when they become available.
NSURLSessionMBS.streamTaskDidBecomeInputStream(streamTask as NSURLSessionStreamTaskMBS, inputStream as NSInputStreamMBS, outputStream as NSOutputStreamMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
streamTask: The stream task that has been completed.
inputStream: The created input stream. This NSInputStream object is unopened.
outputStream: The created output stream. This NSOutputStream object is unopened
This event will only be called after all enqueued reads and writes for the stream task have been completed.
NSURLSessionMBS.streamTaskReadClosedForStreamTask(streamTask as NSURLSessionStreamTaskMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
streamTask: The stream task that closed reads.
This method may be called even if no reads are currently in progress. This method does not indicate that the stream reached end-of-file (EOF), such that no more data can be read.
Some examples using this event:
NSURLSessionMBS.streamTaskWriteClosedForStreamTask(streamTask as NSURLSessionStreamTaskMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
streamTask: The stream task that closed writes.
This method may be called even if no writes are currently in progress.
Some examples using this event:
NSURLSessionMBS.taskDidCompleteWithError(task as NSURLSessionTaskMBS, error as NSErrorMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
task: The task whose request finished transferring data.
error: If an error occurred, an error object indicating how the transfer failed, otherwise nil.
Server errors are not reported through the error parameter. The only errors your delegate receives through the error parameter are client-side errors, such as being unable to resolve the hostname or connect to the host.
Some examples using this event:
NSURLSessionMBS.taskDidFinishCollectingMetrics(task as NSURLSessionTaskMBS, metrics as NSURLSessionTaskMetricsMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
task: The task whose metrics have been collected.
metrics: The collected metrics.
Some examples using this event:
NSURLSessionMBS.taskDidSendBodyData(task as NSURLSessionTaskMBS, bytesSent as Int64, totalBytesSent as Int64, totalBytesExpectedToSend as Integer)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
task: The data task.
bytesSent: The number of bytes sent since the last time this event was called.
totalBytesSent: The total number of bytes sent so far.
totalBytesExpectedToSend: The expected length of the body data. The URL loading system can determine the length of the upload data in three ways
- From the length of the NSData object provided as the upload body.
- From the length of the file on disk provided as the upload body of an upload task (not a download task).
- From the Content-Length in the request object, if you explicitly set it.
The totalBytesSent and totalBytesExpectedToSend parameters are also available as NSURLSessionTaskMBS properties countOfBytesSent and countOfBytesExpectedToSend.
Some examples using this event:
NSURLSessionMBS.taskIsWaitingForConnectivity(task as NSURLSessionTaskMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
task: The task that is waiting for a change in connectivity.
This method is called if the waitsForConnectivity property of NSURLSessionConfigurationMBS is true, and sufficient connectivity is unavailable. The delegate can use this opportunity to update the user interface; for example, by presenting an offline mode or a cellular-only mode.
This method is called, at most, once per task, and only if connectivity is initially unavailable. It is never called for background sessions because waitsForConnectivity is ignored for those sessions.
Some examples using this event:
NSURLSessionMBS.taskWillPerformHTTPRedirection(task as NSURLSessionTaskMBS, response as NSURLResponseMBS, request as NSURLRequestMBS) as NSURLRequestMBS
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
task: The task whose request resulted in a redirect.
response: An object containing the server’s response to the original request.
request: A URL request object filled out with the new location.
Return either the value of the request parameter, a modified URL request object, or NULL to refuse the redirect and return the body of the redirect response.
This method is called only for tasks in default and ephemeral sessions. Tasks in background sessions automatically follow redirects.
Some examples using this event:
NSURLSessionMBS.webSocketTaskDidCloseWithCode(webSocketTask as NSURLSessionWebSocketTaskMBS, closeCode as Integer, reason as MemoryBlock)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
webSocketTask: The WebSocket task that closed.
closeCode: The close code provided by the server. If the close frame didn’t include a close code, this value is 0.
reason: The close reason provided by the server. If the close frame didn’t include a reason, this value is nil.
NSURLSessionMBS.webSocketTaskDidOpenWithProtocol(webSocketTask as NSURLSessionWebSocketTaskMBS, protocol as String)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| event | Cocoa Networking | MBS MacFrameworks Plugin | 20.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | All |
webSocketTask: The WebSocket task that opened.
protocol: The protocol picked during the handshake phase. This parameter is nil if the server did not pick a protocol, or if the client did not advertise protocols when creating the task.
If the handshake fails, the task doesn’t call this event.
The items on this page are in the following plugins: MBS MacFrameworks Plugin.