Do you want to request a feature or report a bug?
Bug
What is the current behavior?
I have a use case where I use pusher to track time.
Users sometimes enter a page and immediately are redirected back (eg. because of lack of permissions).
As an effect I am leaving a channel and then immediately rejoining it.
Doing this seem to be causing a race condition where:
I am getting an error Existing subscription to channel xxx
User leave the channel and never returns causing a gap in my time tracking.
I assume the issue is due to pusher internally handling both events in random order.
So it joins the channel first (causing Existing subscription error) and then leaves the channel (casing a gap in tracking).
As a workaround I have added throttling of messages going to pusher limiting subscribe/unsubscribe to run only once per second, but that did not solve the issue, just reduced it.
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.
pusher = ... // Create pusher instance
pusher.subscribe('test-channel');
await sleep(60000); // Wait a minute simulating staying on the channel
pusher.unsubscribe('test-channel'); // Leave the channel
await sleep(100); // 100ms sleep simulating a single request, or fast action
pusher.subscribe('test-channel'); // I am back
What is the expected behavior?
User should rejoin the channel and stay in it.
Which versions of Pusher, and which browsers / OS are affected by this issue?
Did this work in previous versions of Pusher? If so, which?
Do you want to request a feature or report a bug? Bug
What is the current behavior? I have a use case where I use pusher to track time. Users sometimes enter a page and immediately are redirected back (eg. because of lack of permissions). As an effect I am leaving a channel and then immediately rejoining it.
Doing this seem to be causing a race condition where:
Existing subscription to channel xxx
I assume the issue is due to pusher internally handling both events in random order. So it joins the channel first (causing
Existing subscription
error) and then leaves the channel (casing a gap in tracking).As a workaround I have added throttling of messages going to pusher limiting
subscribe
/unsubscribe
to run only once per second, but that did not solve the issue, just reduced it.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?
User should rejoin the channel and stay in it.
Which versions of Pusher, and which browsers / OS are affected by this issue? Did this work in previous versions of Pusher? If so, which?
Pusher 5.1.0