davidstump / SwiftPhoenixClient

Connect your Phoenix and iOS applications through WebSockets!
MIT License
506 stars 146 forks source link

Problems with connections on WatchOS 9 #224

Closed sergey-g-s closed 1 year ago

sergey-g-s commented 1 year ago

Description

The SwiftPhoenixClient does not work on WatchOS 9. I have been having issues with websockets in my own app, and I believe this issue might be related to that. The problem of detection is only on a real device with WatchOS 9 (it seems that the emulator uses connections from Mac, so it works well there) Everything worked until version WatchOS 9

SwiftPhoenixClient

5.1.0

Xcode Version

14.0

Relevant Log Output

2022-09-13 17:22:04.194857+0300 Watch WatchKit Extension[375:22930] Connection 36: received failure notification
2022-09-13 17:22:04.194935+0300 Watch WatchKit Extension[375:22930] Connection 36: failed to connect 1:50, reason -1
2022-09-13 17:22:04.194950+0300 Watch WatchKit Extension[375:22930] Connection 36: encountered error(1:50)
2022-09-13 17:22:04.195691+0300 Watch WatchKit Extension[375:22930] Task <12FF0666-9653-4B03-A9C1-5D6BCC3DF419>.<1> HTTP load failed, 0/0 bytes (error code: -1009 [1:50])
2022-09-13 17:22:04.196176+0300 Watch WatchKit Extension[375:22930] Task <12FF0666-9653-4B03-A9C1-5D6BCC3DF419>.<1> finished with error [-1009] Error Domain=NSURLErrorDomain Code=-1009 "The internet connection appears to be offline." UserInfo={NSErrorFailingURLStringKey=websocket?vsn=2.0.0&signalingToken="1", NSErrorFailingURLKey=websocket?vsn=2.0.0&signalingToken="1", NSLocalizedDescription=The internet connection appears to be offline.., _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <12FF0666-9653-4B03-A9C1-5D6BCC3DF419>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <12FF0666-9653-4B03-A9C1-5D6BCC3DF419>.<1>}
CHAT ROOM: Socket Errored. Error Domain=NSURLErrorDomain Code=-1009 "Схоже, що немає інтернет-зʼєднання." UserInfo={NSErrorFailingURLStringKey=websocket?vsn=2.0.0&signalingToken="1", NSErrorFailingURLKey=websocket?vsn=2.0.0&signalingToken="1", NSLocalizedDescription=The internet connection appears to be offline., _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalWebSocketTask <12FF0666-9653-4B03-A9C1-5D6BCC3DF419>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalWebSocketTask <12FF0666-9653-4B03-A9C1-5D6BCC3DF419>.<1>}
dsrees commented 1 year ago

I don't think this has anything specific to do with the client, but more watchOS 9. A quick good search brings up some other related issues such as https://github.com/pusher/NWWebSocket/issues/35

Rexios80 commented 1 year ago

Websockets on watchOS are as good as dead: https://developer.apple.com/documentation/technotes/tn3135-low-level-networking-on-watchos

dsrees commented 1 year ago

Thanks for that info, @Rexios80

Rexios80 commented 1 year ago

You might want to remove watchOS from your podspec and package manifest