Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any problems with WebSocketChannel.connect under iOS 17.5 beta (or earlier)? #350

Closed
farr64 opened this issue Apr 29, 2024 · 3 comments
Closed

Comments

@farr64
Copy link

farr64 commented Apr 29, 2024

I ran into an inconsistent behavior

WebSocketChannel.connect works perfectly on most of my test phones:

  • Several (older) iPhones with various (older) versions of iOS.

  • Several Android phones

However, on the latest and greatest iPhone 15 Pro under iOS 17.5 beta, WebSocketChannel.connect fails consistently with a time out (which I detect via try/catch for await on .ready).

Curiously, this same iPhone connects perfectly to the WebSocket server using the exact same Flutter app as a WebApp (served by a remote Apache server) and as the corresponding PWA. The "native" version of the Flutter app fails with this iPhone but the "not-so-native" WebApp and PWA versions of the same Flutter app work perfectly withWebSocketChannel.connect. Beats me.

Perhaps this failure also happens on other recent versions of iOS, whether beta or not, but I just started noticing this behavior. At first, I thought I had introduced a subtle bug in my app but then I became suspicious

While searching for clues, I saw this on Apple's Developer forums:

https://forums.developer.apple.com/forums/thread/685403

They mention iOS 15, so this misbehavior might be older than I suspect.

Has anyone here ran into this inconsistent behavior? Any recommended work arounds for Flutter's web_socket_channel ?

Thanks.

@brianquinlan
Copy link
Contributor

brianquinlan commented May 9, 2024

@farr64
Copy link
Author

farr64 commented May 10, 2024

Thanks @brianquinlan

I'll investigate those approaches.

In the meantime, I discovered something that might be of general interest: Local network access vs. remote network access.

Both of these servers are on our local network:

  • Our WebSockets server (which the Flutter app accesses via web_socket_channel)
  • Our Web server (which the Flutter app accesses via webview_flutter)

The Flutter app running on older iPhones can access both of these servers when connected via Wi-Fi to our local network (and they can also access them from outside of our local network).

The exact same Flutter app running on my new iPhone 15 Pro under iOS 17.5 beta can't access either of these servers when connected via Wi-Fi to my local network.

Out of curiosity, I decided to disabled Wi-Fi access and BINGO: The Flutter app running on my new iPhone 15 Pro under iOS 17.5 beta successfully accesses both of these servers from outside of our local network.

Somehow, something somewhere (in some new iOS hardware and/or software configuration) is not permitting the Flutter app's web_socket_channel and webview_flutter to access servers on the local network.

That "something somewhere" (in some new iOS hardware and/or software configuration) happily permits the Flutter app's web_socket_channel and webview_flutter to access remote servers.

Any ideas?

Fortunately, as developers, the members of my team are the only ones who will run into these challenges, because our customers are not within our local network.

I'm the first team member to run into this, so I'm the canary in the coal mine. It's a bit of a pain but, now that I found out a work-around, I can live with this annoyance. Not ideal, but endurable.

It would be useful to figure out:

  • what is causing this new unexpected behavior
  • how we can proactively work around this unexpected behavior (a new capability or permission or whatever)

Thanks for any suggestions.

@farr64
Copy link
Author

farr64 commented May 13, 2024

I just upgraded my version of iOS 17.5 beta to the official iOS 17.5 (21F79) and WebSocketChannel.connect now works perfectly and it has no problem accessing the WebSocket server on our local network.

Beats me.

Thanks for the suggestions, @brianquinlan

@farr64 farr64 closed this as completed May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants