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

Resubscribe channel after reconnect even though channel has been unsubscribed before being disconnected #46

Closed
rlebosse opened this issue Nov 22, 2017 · 7 comments · Fixed by #48

Comments

@rlebosse
Copy link

I created a Centrifuge client with retry: true, resubscribe: true and connected it.

  • I subscribe to a channel called mychannel.
  • I unsubscribe the channel mychannel.
  • Centrifuge client is disconnected (for instance Centrifugo server is stopped).
  • Centrifuge client is reconnected (for instance Centrifugo server is started).
  • Centrifuge client re-subscribes to the channel mychannel.

Is this normal considering the fact that I intentionnally unsubscribed this channel before the disconnection, meaning that I wanted it unsubscribed, even after the client disconnection-reconnection.

Thanks a lot !

@FZambia
Copy link
Member

FZambia commented Nov 22, 2017

Hello! Thanks for report! This looks like a bug - does this happen with latest client version?

@FZambia
Copy link
Member

FZambia commented Nov 25, 2017

@rlebosse thanks for pointing on this, I just merged a fix, will create new release soon, if you have a time to verify that problem gone away with that patch - it would be cool.

@rlebosse
Copy link
Author

@FZambia thanks for you reactivity !

I just tried centrifuge-js new version (1.4.7) and I'm facing another issue, which might be a consequence of fixing this one.

  • I subscribe to a channel ch1.
  • I subscribe to a channel ch2.
  • Centrifuge client is disconnected (for instance Centrifugo server is stopped) : in the console logs, I see that the client unsubscribes from channel ch2 which should not happen.
  • Centrifuge client is reconnected (for instance Centrifugo server is started) : the client resubscribes to the channel ch1 but nothing happens with ch2.

Do you know why it does so ? Do you want me to create a new issue to handle this bug ?
Thanks !

@FZambia FZambia reopened this Nov 28, 2017
@FZambia
Copy link
Member

FZambia commented Nov 28, 2017

@rlebosse I will try to reproduce ASAP. At least how this must work:

  • subscribe to a channel ch1
  • subscribe to a channel ch2
  • Centrifuge client is disconnected (for instance Centrifugo server is stopped) : in this case you must receive 2 unsubscribe events for channel ch1 and for channel ch2. And also disconnect event.
  • Centrifuge client is reconnected - in this case both channels must resubscribe.

@FZambia
Copy link
Member

FZambia commented Nov 28, 2017

@rlebosse just reproduced and fixed - yes, that was introduced in 1.4.7.

There was an attempt to fix resubscribing when calling Centrifugo HTTP API unsubscribe method - but looks like it's not possible at moment and will be implemented in future with some changes on Centrifugo server side. At moment when calling unsubscribe via server HTTP API client will be unsubscribed but will resubscribe after reconnect (i.e. similar problem to what you described in this issue). Fix is not too hard - Centrifugo server should not send unsubscribe messages on shutdown - and all unsubscribe events on shutdown must be handled by client side entirely. Will do this in future releases.

If you don't use HTTP API unsubscribe then things should work ok for you now.

@FZambia
Copy link
Member

FZambia commented Nov 29, 2017

The fix for HTTP API unsubscribe resubscribe behaviour started here - as soon as it released I will update this client.

FZambia added a commit that referenced this issue Aug 6, 2018
FZambia added a commit that referenced this issue Aug 7, 2018
@FZambia
Copy link
Member

FZambia commented Aug 14, 2018

Should be fixed in 1.5.0

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

Successfully merging a pull request may close this issue.

2 participants