-
Notifications
You must be signed in to change notification settings - Fork 336
[🐛] Failed Reconnect After Extended Network Down (≈10s) #2952
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
Comments
Hi @arekkubaczkowski , Thanks a lot for the report ! I fiddled around with this for quite a bit today and could not get the particular behaviour to reproduce. In that regard, I have a couple of follow-up questions:
|
hi @isekovanic thanks for the reply.
|
@isekovanic I think I found something. We’re using GetStream along with LiveKit for streaming. Our logic calls |
That's very interesting indeed ! I shall check it out later today and try to emulate this behaviour - but this was most helpful, so thanks a bunch ! |
Hi @arekkubaczkowski , So first off thanks again for your astute observations on the topic ! After spending quite a bit of time tonight playing around with what you described, I was unfortunately not able to reproduce it at all. However, I do have some ideas of what might be going on. Traditionally, our SDK has 2 ways in which it can kill a WS connection:
Both of these are different usecases, but similar in terms of what they do in these scenarios. The main hook where all the magic happens is this one. Let's analyze it further.
My current theory is the following:
I have tried:
and after each one of these the remount afterwards uses the recovered connection. With that said, I'm at a bit of a loss and kind of out of ideas. However, I do have some things you could check:
Sorry for the wall of text and for not being able to help more. |
Oh and one more thing I forgot to mention - if you're trying to lose connection by turning wi-fi off, you likely have to put the app in background mode; which in turn goes down the other route rather than actually simulating losing internet. To properly simulate this, you can either:
This should at least isolate the unintended consequences of a connection close whenever doing this. |
@isekovanic I appreciate your detailed input. I just tried to reproduce it by unmounting/mounting the chat instance and you're right, this scenario works fine. However if you do the same but on the navigation level, then it breaks indeed.
I am able actually to reproduce it all the time. ps: I have disabled |
I just found out that when I enable
I actually cannot do it because I get |
Okay, so that's a good start ! I was actually testing on our RN CLI sample apps, so perhaps there's a hint on how this works within how 3 follow up questions:
That's interesting, that error should not be the one appearing in these scenarios; but maybe it reveals something else. |
PS: I will actually try with your steps to reproduce a bit later today and see |
the only thing that I run globally and store across the entire app is the chat client connection (useCreateChatClient). the one reason why I would need to have multiple chat instances is that I need to support multiple themes (style prop) |
No, this should be alright.
did you manage to try this ?
you shouldn't need multiple |
calling |
Are you running |
that's strange but also doesn't help |
Ah, but wait - I think I'm being silly. You're still offline when doing that right ? It won't be able to establish the connection anyway. Can you try doing it once you regain connection ? |
nope, I am calling it after turning the connection on. Moreover, |
Yeah, that would probably explain why it can't reconnect - I guess it relates to what I suspected; the entire I'll have a go at your updated reproduction steps probably tonight and see what's going on, using navigation specifically. |
@isekovanic have you managed to reproduce it by chance? |
Hi @arekkubaczkowski , No, sorry - very busy past couple of days and a ton of stuff to do. I'll let you know as soon as I try it out. |
@isekovanic hi, I would like to double check if it's still on your plate. I would be grateful for any update 🙏 |
Hi @arekkubaczkowski , yes - it still is; it's just one of those scenarios where my work queue has grown quite large (and keeps changing). I promise the team and I will have a look at this soon. In the meantime, if you happen to have some bandwidth - a minimum reproducible sample would be extremely appreciated, especially as something to go off on (to avoid any potential back and forth later on if it's not reproducible properly). I'm very sorry for the wait ! |
@isekovanic please follow these steps:
|
Hi @arekkubaczkowski , First off - thanks so much for taking the time to create a minimal reproducible sample. The team and I greatly appreciate it ! Apologies for the delay (again), things are getting pretty busy as we're pushing for the V7 release as well as doing I spent the better part of last night debugging this in depth and have indeed found the issue. Let me break in down in a TL;DR format:
That would look something like this:
right about here. Please take this as an example of what the workaround should look like; ideally you would want to only do this when needed (i.e whenever unmounting a
As mentioned before, we can unfortunately not immediately fix this in the SDK as it's a much bigger rabbit hole with a ton of implications at this time. I will however add this to our backlog so that we may pick it up in the future, however for the time being you can try the workaround out and let me know if it indeed helps. Thanks again ! |
@isekovanic The workaround you suggested does work for this specific scenario. However, we’re still facing issues with reconnection failures after the connection is lost. Many users report that in poor network conditions, the chat stops working entirely. Unfortunately, the only solution that seems to help is restarting the app. Simply re-entering doesn’t fix the issue due to the problem we discussed earlier and the workaround doesn't seem to work in this specific case |
Uh oh!
There was an error while loading. Please reload this page.
Issue
Description
We’ve observed that the GetStream library fails to reconnect automatically after a network outage lasting around 10 seconds or more. In addition, re-initializing the chat instance—by navigating back to the previous screen and then returning to the chat page—does not resolve the issue. A complete app reboot is required to restore connectivity.
Steps to Reproduce
Simulate Network Down:
Extended Network Outage:
Restore Network Connection:
Observe:
Additional Re-Initialize Chat Instance:
Steps to reproduce
Steps to reproduce the behavior:
etc...
Expected behavior
Project Related Information
Customization
Click To Expand
Offline support
Environment
Click To Expand
package.json
:# N/A
react-native info
output:stream-chat-react-native
version you're using that has this issue:e.g. 5.4.3
e.g. Android 10
e.g. iPhone 11
Additional context
Screenshots
Click To Expand
The text was updated successfully, but these errors were encountered: