centrifugal / centrifuge-js

JavaScript client SDK to communicate with Centrifugo and Centrifuge-based server from browser, NodeJS and React Native. Supports WebSocket, HTTP-streaming over Fetch and Readable Stream API, EventSource, WebTransport.
https://centrifugal.dev
MIT License
411 stars 104 forks source link

Fix missing unsubscribe frames for optimistic subscriptions #274

Closed ThisIsEsh closed 8 months ago

ThisIsEsh commented 8 months ago

Right now centrifuge does not send unsubscribe frames if unsubscribe happens between client and server connect frames, but there might be subscribe frames in the same batch with connect frame.

This leads to situation when server have channel in it's registry, but client think that there's no such subscription for channel. If client will try to subscribe to this channel again, it will receive already subscribed error from server.

FZambia commented 8 months ago

@ThisIsEsh hello! I can imagine how much debugging required for finding this. Many thanks. I reproduced locally – could you please review the alternative approach to fix this: #275 ?

FZambia commented 8 months ago

Closing in favour of https://github.com/centrifugal/centrifuge-js/pull/278