Skip to content

5.1.0

Compare
Choose a tag to compare
@FZambia FZambia released this 08 Apr 04:44
· 11 commits to master since this release
3bac6dd

What's Changed

  • Send commands based on transport state instead of connected state by @ThisIsEsh in #278.

The above pull request, contributed by @ThisIsEsh, changes how centrifuge-js interacts with transport in the bidirectional case. Now, the client sends commands as soon as the transport is ready, instead of waiting for the connect reply. This should reduce the time until the initial subscription in some cases. In fact, this approach makes all subscriptions optimistic.

More importantly, it eliminates the race conditions we had when unsubscribing from channels. Previously, in some cases, unsubscribe frames could be omitted by centrifuge-js (see more details about when exactly in #274). This could result in an already subscribed error when the client tried to subscribe to the channel again.

The change also includes unsubscribe fixes for the emulation transport where centrifuge-js used optimistic subscriptions. When unsubscribe was called before the transport was established, we received a node not found error on the server side. Disabling optimistic subscriptions in the emulation case and adding new logic in #278 now result in correct unsubscribe behavior. Actually, we had already disabled optimistic subscriptions for SSE transport before, so this adjustment only affects emulation based on HTTP streaming.

Other changes

New Contributors

Full Changelog: 5.0.2...5.1.0