-
Notifications
You must be signed in to change notification settings - Fork 147
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
Problems with connections closing and not re-establishing #214
Comments
The reconnection logic Should Just Work™️ but there may be some edge cases. When setting Network Link Conditioner to "Very Bad Network", are you able to reproduce the issue? Are you using Starscream or URLSessionWebSocketTask? Also, I would recommend only using a single |
Yes, it sometimes reproduces with Very Bad Network. I'm using
Interesting, our back-end guys recommended separate sockets. |
The client (which is a port of how the phoenix.js client was designed) is built to multiplex over a single socket connection. All that a channel is, is filtering If you logged messages on each socket, i bet you'll see the same messages on each for both channels, unless your backend team is for some reason filtering messages to each socket based on open channels. That said, I'm not 100% sure why one channel disconnects and the other does not, but I would recommend you try using a single socket and seeing if the issue persists |
A little more investigation: It seems that generally, channels do reconnect. Socket disconnects are a little less reliable, although not 100% so. It would be nice if there was more logging of re-connection-in-the-face-of-errors attempts. |
What is the default expected behavior in the presence of severe network errors? We're seeing a general behavior of SwiftPhoenixClient disconnecting and not re-connecting.
Interestingly, we see two separate behaviors. Our app connects to the same
ws
URL with two differentSocket
s, and then a single channel is created for each Socket, each with a different topic (one for "auction", one for "chat").To reproduce the behavior, I ran the code on my iPhone and set the Network Link Conditioner to "Very Bad Network." But note that our users (and even some of our devs) are reporting apparent disconnects too frequently in the field.
I see a lot of heartbeat timeouts on the
auction
channel, but never on thechat
channel. Eventually I’ll see timeouts on thetransport,
and then things just close:What can we do here to try to keep re-establishing the connection? Does adding an error or close callback give me a good place to re-connect?
The text was updated successfully, but these errors were encountered: