You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Presence.subscribe() reports success after the server rejects it #757
Doc._handleSubscribe, by contrast, returns on error before marking itself subscribed.
Repro
Reject ps in 'receive' middleware
presence.subscribe(cb): cb gets the error, but presence.subscribed is true
presence.subscribe(cb) again: cb is called with no error, and nothing is sent to the server
Reconnect: _resubscribe sends the subscription again, and its rejection is emitted as 'error' on the Presence, which throws if nothing is listening
This also means apps can't reject presence subscriptions in middleware without leaving the client in a broken state. The presence access control docs in #752 recommend filtering in 'sendPresence' for that reason.
Suggested fix
On error, leave subscribed alone and reset wantSubscribe, as Doc does, so a later subscribe() actually retries and a reconnect doesn't re-send a subscription the server already refused.
Activity