Centrifuge Js Versions Save

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 and SockJS.

5.1.1

1 month ago

What's Changed

  • Fix reconnect on close before transport open by @FZambia in https://github.com/centrifugal/centrifuge-js/pull/281 . If you observed rare WebSocket is closed before the connection is established warnings in console and no reconnect after that - this should fix it.

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/5.1.0...5.1.1

5.1.0

1 month ago

What's Changed

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: https://github.com/centrifugal/centrifuge-js/compare/5.0.2...5.1.0

5.0.2

2 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/5.0.1...5.0.2

5.0.1

7 months ago

What's Changed

New Contributors

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/5.0.0...5.0.1

5.0.0

8 months ago

What's Changed

In v5 release we are moving to Rollup to build the library. For centrifuge-js this means both ESM and CommonJS support and thus solving some issues when users could not use SDK with their existing toolchains (ex. #232, #245). The migration includes changes in how we provide Protobuf version of Centrifuge client. That's why we've made a new major v5 release.

For users which work with JSON-based Centrifuge client (default behaviour) the migration to v5 should be smooth and require no code changes.

Users of Protobuf version of the client need to change how they import Centrifuge when using the library. Also, we removed protocol option of Centrifuge instance config object. Imported Protobuf client now automatically uses Protobuf protocol under the hood.

For example, previously, when using Protobuf version of Centrifuge client, you have to import Protobuf client and then provide an option to constructor:

import Centrifuge from 'centrifuge/build/protobuf';

const centrifuge = new Centrifuge('wss://centrifuge.example.com/connection/websocket', {
    protocol: 'protobuf'
});

Now this simplifies to:

import { Centrifuge } from 'centrifuge/build/protobuf';

const centrifuge = new Centrifuge('wss://centrifuge.example.com/connection/websocket', {});

Note - changed import and no need to pass protocol: 'protobuf'. See readme for more information about using Protobuf client and constructing binary payloads.

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/4.1.0...5.0.0

4.1.0

9 months ago

What's Changed

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/4.0.1...4.1.0

4.0.1

10 months ago

What's Changed

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/4.0.0...4.0.1

4.0.0

10 months ago

What's changed

This release changes the semantics of working with connection tokens described in Centrifugo v5 release post.

Previously, returning an empty token string from getToken callback resulted in client disconnection with unauthorized reason.

Now returning an empty string from getToken is a valid scenario which won't result into disconnect on the client side. It's still possible to disconnect client by throwing a special UnauthorizedError() error from getToken function.

And we are putting back setToken method to the SDK – so it's now possible to reset the token to be empty upon user logout.

Other changes

New Contributors

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/3.1.2...4.0.0

3.1.2

1 year ago

What's Changed

This release contains important connection stability improvements. If you experience disconnections due to bad request or stale reasons – this release may fix if not all but most of them.

  • Fix connection leak due to transport close race, #225.
  • Use network events in connecting state, #227. This allows immediately close transport upon offline event while SDK is in connecting state. Previously we only started handling these events after successful connect. Also fixes setting duplicate onlne/offline event handlers.
  • Update README: actual way to override WebSocket to pass headers in non-browser environment, #226

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/3.1.1...3.1.2

3.1.1

1 year ago

What's Changed

New Contributors

Full Changelog: https://github.com/centrifugal/centrifuge-js/compare/3.1.0...3.1.1