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

Randomly not working #129

Open
fabiendeborde opened this issue Jan 7, 2024 · 4 comments
Open

Randomly not working #129

fabiendeborde opened this issue Jan 7, 2024 · 4 comments

Comments

@fabiendeborde
Copy link

Hello, I finally got it to work by using a single file as a hook at the top of my app.
I am monitoring the connection status as some people said it was randomly disconnecting, using the onConnectionStateChange method in pusher.init, and so far it didn't disconnect...but, after some time it stops receiving events.

My app is a one screen, always awake dashboard.
After about 30 minutes (i feel like the duration is pretty random), the app stops receiving events, but the onConnectionStateChange didn't change at all.
I am logging the following:

  • onConnectionStateChange
  • onError
  • onEvent
  • onSubscriptionSucceeded
  • onSubscriptionError
  • onSubscriptionCount
    but there is nothing to be logged...

Am I missing something during initialization ?
(I used to use the previous pusher-js/react-native and this never happened)

@benw-pusher
Copy link
Contributor

Is the app open and active during this time? If the app is closed/backgrounded then it could be that the connection is terminated at the OS level, but the app is not active or permitted to run the necessary code to detect the connection state change, which is why there is no logging present.

@fabiendeborde
Copy link
Author

Thanks for your answer @benw-pusher !
The app is open and active all day, but I close it during the night.
I will try to see if I can find a way to resume the connection when the app is active again.

I have no idea why, but today the connection seems to stay active a lot longer than usual (about 5h for now)
I'll try to give more information tomorrow if I can.

@benw-pusher
Copy link
Contributor

Hi @fabiendeborde did you see the improved behaviour persist?

@fabiendeborde
Copy link
Author

Hey @benw-pusher , sorry I was extra busy at work...

Sometimes when the app comes back from device sleep the connection is still active, sometimes it is not.
I am not doing much mobile app so I can't say for sure but seems like it's coming from the OS will... :)

To be sure I made a status badge (which is quite accurate), and a button next to it to reconnect when needed.

I don't remember having to handle reconnection in the previous package, but the app was made about 2~3 years ago, so it might be OS related and not a problem from this library.

I hope the feedback helped.

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