-
Notifications
You must be signed in to change notification settings - Fork 374
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
Constant connection state changes when using other than ws transports #802
Comments
I'm not seeing the same behaviour here. Typically state changes would be a result of network conditions - do you see the same behaviour if you use a different device/network? |
I was able to pinpoint it to the activityTimeout option. I am sorry my example in the original post wasn't 100% complete. I thought the timeouts would be irrelevant. My config actually also sets the activityTimeout and pongTimeout to the options too.
Removing the activity timeout fixes the issue. Having it set to 5 seconds (also 20 seconds) results in the reconnects. Changing it to 25 seconds seems like it's enough and the reconnects don't happen anymore, however our thinking was that 25 seconds gets dangerously close to 30s which we would like to avoid, since some firewalls kill inactive ws connections after 30s. According to the docs, a shorter activityTimeout might cause unnecessary traffic. Is there a bug that might be causing the reconnects despite the unnecessary traffic or am I missing something? |
Do you want to request a feature or report a bug?
Possibly report a bug.
What is the current behavior?
When using other transports than web sockets, e.g.
xhr_polling
, thestate_change
event keeps firing and keeps toggling betweenconnecting
andconnected
states. That probably makes sense given the nature of the polling mechanism. However, what would be the proper way to then check if there is a successful connection?p.s. I am not intentionally trying to use
xhr_polling
, I rely on the default config which switches toxhr_polling
in case if ws is unavailable.If the current behavior is a bug, please provide the steps to reproduce and
if possible a minimal demo of the problem via https://jsfiddle.net or similar.
What is the expected behavior?
Have a way to reliably detect connection state changes that doesn't change every second. Imagine you want to react to a not connected state, it's quite difficult when the state changes constantly.
Checking for
pusherConnection.connection.state
directly seems to work, however I have to query it manually. Is that the better way or is there a bug withstate_change
?Which versions of Pusher, and which browsers / OS are affected by this issue?
Did this work in previous versions of Pusher? If so, which?
^8.0.1
(tried with8.3.0
directly too)The text was updated successfully, but these errors were encountered: