Closed scottybobandy closed 11 months ago
Quick update with some additional checks required to compile for watchOS:
@available(watchOS 6, *)
for accessing AsyncStream
APIs@available(watchOS 9, *)
for runtime support for parameterized protocol types (though this only appears to be used for testing)ππ½ thank you for flagging this. I'm out of town through the first week of December, but can investigate when I'm back if @eseay doesn't get to it before then. Alternatively, feel free to submit a PR in the meantime π
Hey @scottybobandy - Thank you for contributing https://github.com/connectrpc/connect-swift/pull/227! I also spent some time investigating this, and I opened a PR to introduce CI validation for watchOS, tvOS, and iOS (rather than only for macOS) as a follow-up: https://github.com/connectrpc/connect-swift/pull/231
In addition, Technote TN3135 describes the 3 specific circumstances when low-level networking is allowed on watchOS. watchOS blocks low-level networking outside of these specific circumstances, impacting aspects of URLSession including URLSessionStreamTask and URLSessionWebSocketTask.
With this limitation on low-level networking, it's likely stream requests will fail even if we can compile and run on watchOS. This is OK for our immediate use-case as we only need to execute unary requests, but a consideration for the future.
I read through the technote you linked, and I think the circumstances in which streaming is allowed by watchOS are tied to application-level features (such as doing networking while streaming audio). That said, there isn't much we can/should do from a networking library perspective, since after your PR Connect will work if it's being used within the boundaries set by watchOS. Relatedly, the tests being run in the PR pass on watchOS because of this detail in the technote:
When writing watchOS networking code, test it on a real device; the simulator always allows low-level networking.
I think between #227 and #231 we should be covered :)
Hey team π
We're working on adopting
connect-swift
and are running into some issues compilingconnect-swift
for our watchOS app.For context, we are attempting to perform unary requests from a watchOS app using the
URLSessionHTTPClient
andgrpc-web
protocol. However,connect-swift
importsCFNetwork
(only 1 explicit import here AFAIK) which is unavailable on watchOS, so we can't actually compile for our watchOS target.In addition, Technote TN3135 describes the 3 specific circumstances when low-level networking is allowed on watchOS. watchOS blocks low-level networking outside of these specific circumstances, impacting aspects of
URLSession
includingURLSessionStreamTask
andURLSessionWebSocketTask
.With this limitation on low-level networking, it's likely stream requests will fail even if we can compile and run on watchOS. This is OK for our immediate use-case as we only need to execute unary requests, but a consideration for the future.
Is watchOS support, or at a minimum, the ability to compile and execute unary requests, a reasonable prerequisite for a stable v1.0 release?