Releases: centrifugal/centrifuge-js
2.8.1
- Support
sockjsTimeout(number) option which translates to SockJS.timeout option - i.e. a minimum timeout in milliseconds to use for the transport connections. By default SockJS uses timeout determined automatically based on calculating round trip time during info request.
2.8.0
Update to work with Centrifuge >= v0.18.0 and Centrifugo v3.
Breaking change in server behavior. Client History API behavior changed in Centrifuge >= v0.18.0 and Centrifugo >= v3.0.0. When using history call it won't return all publications in a stream by default. See Centrifuge v0.18.0 release notes or Centrifugo v3 migration guide for more information and workaround on server-side. If you are using centrifuge-js with older server versions then everything without using history options like limit and since then everything should work the same way. Since this is a change in a server behavior we don't release a new major centrifuge-js version.
Other changes:
- Protocol definitions updated to the latest version
- When working with Centrifugo v3 or Centrifuge >= v0.18.0 it's now possible to avoid using
?format=protobufin connection URL when using Protobuf protocol. The intent to use binary Protobuf protocol can now be set explicitly in client options. In this case client will negotiate Protobuf protocol with a server using WebSocket subprotocol mechanism (in request headers). Pull request. - It's now possible to call subscribe and provide custom subscribe options. One subscribe option available now is
since– which allows setting knownStreamPositionand initiate automatic recovery. Pull request. - Support history
reverseoption (Centrifuge >= v0.18.1 and Centrifugo v3 only)
2.7.7
2.7.6
2.7.5
2.7.4
2.7.3
2.7.2
2.7.1
2.7.0
- add missing
offsetto TS definitions forPublicationContext, note thatseqandgenfields considered deprecated and will go away with next majorcentrifuge-jsrelease - add top-level methods:
history,presence,presenceStats– those are useful when using sever-side subscriptions - fix wrong error format of top-level
publishPromise reject branch – it now contains protocol error object (withcodeandmessagefields) - possibility to set
nameandversionprotocol fields over Centrifuge config options - remove unused
promiseoption from configuration - add history iteration API (usage limited to Centrifuge library for Go at the moment) - see example below
- subscribe success event context in positioned subscriptions (added in Centrifuge library v0.15.0) now contains
streamPositionobject (with currentoffsetandepochfields) - updated
protobuf-jsdependency (now^6.10.2) - all dev-dependencies updated and now use the latest versions of webpack, babel, eslint, mocha etc
- internal code refactoring of Subscrption methods - code is simplified and more reusable now
Let's look at history pagination feature in more detail. It's now possible to iterate over channel history this way:
resp = await subscription.history({'since': {'offset': 2, 'epoch': 'xcf4w'}, limit: 100});If server can't fulfill a query for history (due to stream retention - size or expiration, or malformed offset, or stream already has another epoch) then an Unrecoverable Position Error will be returned (code 112).
To only call for current offset and epoch use:
resp = await subscription.history({limit: 0});I.e. not providing since and using zero limit.
Due to backward compatibility history call without arguments will return full existing history in channel (though it's possible to limit max number of publications to return on server side).
For now history pagination feature only works with Centrifuge library based server and not available in Centrifugo.