SwiftPhoenixClient icon indicating copy to clipboard operation
SwiftPhoenixClient copied to clipboard

async/await URLSessionWebSocketTask receive

Open yeahphil opened this issue 1 year ago • 1 comments

Just looking over #280 -- @dsrees I haven't independently verified this but want to call your attention to this post: https://www.donnywals.com/iterating-over-web-socket-messages-with-async-await-in-swift/

Check the last part of the post (search for "If you're targetting iOS 17 or newer you can ignore this next part")

Apparently there's a bug with cancelling URLSessionWebSocketTask in older iOS that may impact this (otherwise very appealing) change. Causing Tasks that never finish, hanging on an await.

yeahphil avatar Feb 03 '25 00:02 yeahphil

Hm maybe the best thing is to check OS and switch between async and a callback.

I also want to explore using the Network framework for the underlying connection

dsrees avatar Feb 03 '25 00:02 dsrees