Releases: centrifugal/centrifuge-js
5.0.0
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: 4.1.0...5.0.0
4.1.0
What's Changed
- Fix types: use Record instead of Map by @FZambia in #244
- Bump semver from 6.3.0 to 6.3.1 by @dependabot in #240
- Bump word-wrap from 1.2.3 to 1.2.4 by @dependabot in #241
Full Changelog: 4.0.1...4.1.0
4.0.1
v4.0.0
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
- Add missing curly braces to node js README.md example by @MaximZemskov in #230
- Schedule reconnect from disconnect function instead of transport onClose by @FZambia in #234
New Contributors
- @MaximZemskov made their first contribution in #230
Full Changelog: 3.1.2...4.0.0
3.1.2
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: 3.1.1...3.1.2
3.1.1
What's Changed
- Fix typo by @nmorel in #212
- Bump json5 from 2.2.1 to 2.2.3 by @dependabot in #211
- Bump undici from 5.8.2 to 5.19.1 by @dependabot in #215
- Fix missing connInfo and chanInfo in presence by @FZambia in #221
New Contributors
Full Changelog: 3.1.0...3.1.1
3.1.0
What's Changed
- Fixed 'Subscription methods and events' link by @ArmanJR in #197
- Bump undici from 5.8.1 to 5.8.2 by @dependabot in #198
- React on network online/offline events by @FZambia in #204
- Fix non-working HTTP-streaming in browser build due to esbuild minification issue
New Contributors
Full Changelog: 3.0.1...3.1.0
3.0.1
3.0.0
Breaking changes
This release adopts a new iteration of Centrifugal protocol and a new iteration of API. Client now behaves according to the client SDK API specification. The work has been done according to Centrifugo v4 roadmap.
Check out Centrifugo v4 release post that covers the reasoning behind changes here.
New release only works with Centrifugo >= v4.0.0 and Centrifuge >= 0.25.0. See Centrifugo v4 migration guide for details about the changes in the ecosystem.
Note, that Centrifugo v4 supports clients working over the previous protocol iteration, so you can update Centrifugo to v4 without any changes on the client side (but you need to turn on use_client_protocol_v1_by_default
option in the configuration of Centrifugo, see Centrifugo v4 migration guide for details).
Release notes:
- new API according to the new SDK API specification
- client migrated to Typescript, all public API is strictly typed, including
EventEmitter
callbacks - SockJS is now DEPRECATED in Centrifugal ecosystem and requires explicit configuration, see the library readme
- introducing our own WebSocket emulation layer - based on HTTP-streaming and SSE (Eventsource) fallbacks
- experimental WebTransport support (only works with Centrifugo v4 experimental HTTP/3 support)
- optimistic subscriptions to reduce connect latency
- redesigned PING-PONG (pings are only sent from server to client now)
- resilient subscriptions which handle temporary server errors and re-subscribe (with full jitter backoff)
3.0.0-beta.0
This is a pre-release of centrifuge-js
v3, which is compatible with Centrifugo v4. See Centrifugo v4 roadmap. The source code is still in v3_dev
branch - see the open PR