> On Apr 16, 2016, at 3:29 PM, Daryle Walker <[email protected]> wrote: > > The theoretical Gopher-aligned NSURLProtocol class should be able to allocate > a NSURLSession object and make a NSURLSessionStreamTask from there.
Oh! I finally looked at the API more closely and saw that the factory method only takes a hostname and a port, not a URL as with the other task types. So this makes a lot more sense to me now. Sorry for being confused. In that light, NSURLSessionStreamTask seems to be an equivalent of the existing +[NSStream getStreamsToHostWithName:…] API, that fits into the NSURLSession way of doing things. Two specific advantages over NSStream that I see at first glance are: * It has async read and write methods that call completion blocks, which is a lot easier to use than the NSStream delegate API; * It can be scheduled on an NSOperationQueue (NSStream only works with runloops.) * Looks like enabling TLS is a lot simpler than with NSStream. Plus the fact that you can easily choose to make a direct connection, or ‘tunnel’ the connection through HTTP as WebSockets does. —Jens
_______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/macnetworkprog/archive%40mail-archive.com This email sent to [email protected]
