Skip to content

Releases: centrifugal/centrifuge-js

2.7.3

31 Mar 10:54
Compare
Choose a tag to compare
  • SubscribeSuccessContext can contain data field if custom data returned from a server in a subscribe result.

2.7.2

03 Mar 20:23
Compare
Choose a tag to compare
  • Handle server-side SUB push in Protobuf case (previously ignored). Sub push is a message that contains information about server-side subscription made after connection already established.

2.7.1

16 Feb 14:22
Compare
Choose a tag to compare
  • Fix type definitions - see #133

2.7.0

06 Feb 15:25
Compare
Choose a tag to compare
  • add missing offset to TS definitions for PublicationContext, note that seq and gen fields considered deprecated and will go away with next major centrifuge-js release
  • add top-level methods: history, presence, presenceStats – those are useful when using sever-side subscriptions
  • fix wrong error format of top-level publish Promise reject branch – it now contains protocol error object (with code and message fields)
  • possibility to set name and version protocol fields over Centrifuge config options
  • remove unused promise option 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 streamPosition object (with current offset and epoch fields)
  • updated protobuf-js dependency (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.

2.6.4

15 Jul 20:04
Compare
Choose a tag to compare
  • fix missing info in Publication context
  • add namedRPC method to call RPC with method string

2.0.0

20 Sep 06:43
Compare
Choose a tag to compare

This is a new major release of library updated to work with Centrifugo v2 and Centrifuge library. Library is now written using more actual Javascript instruments - with Webpack and ES6 classes. See readme for more information about new API and how to use library in general.

Highlights:

  • Webpack and ES6 for code base
  • JSON and Protobuf (only Websocket) serialization formats supported
  • new presenceStats method of subscription