Releases: centrifugal/centrifuge
v0.28.0-rc.1
This is a release candidate of Centrifuge v0.28.0 with updated Redis Broker
and PresenceManager
implementations using https://github.com/rueian/rueidis library. See #210.
v0.27.2
v0.27.0
What's Changed
- Disconnect clients in case of inappropriate protocol by @FZambia in #256
- Shutdown nodes in tests by @j178 in #252
- Fix data race in tests by @FZambia in #254
- Command read handler by @FZambia in #259
- Avoid flushing remaining in some disconnect cases by @FZambia in #260
- Test on Redis 5 by @FZambia in #261
- Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 by @dependabot in #267
- Adding a tip on connecting from localhost by @Drabuna in #265
gorelease -base v0.26.0 -version v0.27.0
# github.com/centrifugal/centrifuge
## compatible changes
(*Node).OnCommandRead: added
CommandReadEvent: added
CommandReadHandler: added
DisconnectInappropriateProtocol: added
# summary
v0.27.0 is a valid semantic version for this release.
New Contributors
Full Changelog: v0.26.0...v0.27.0
v0.26.0
In this release we are finishing up a migration to client protocol v2: experimental marks removed, ping/pong configuration standardized. Most probably this is a last minor release that supports Go 1.17.
- Standardize a way to configure server-to-client ping/pong using
PingPongConfig
struct - #250 - Add possibility to set subscription Source, which may be returned later when calling
Client.ChannelsWithContext
method - #249 - Refactor Redis Engine to avoid leaking connection in tests (and possibly in production in case of unstable network between application and Redis). See #237
- Add
nodeRegistry.size()
to improve nodes registry performance a bit #236 - Fix some data races in tests #240 and avoid blinking tests #241
- Add Redis Cluster benchmarks #238
gorelease -base v0.25.0 -version v0.26.0
# github.com/centrifugal/centrifuge
## incompatible changes
HTTPStreamConfig.AppLevelPingInterval: removed
HTTPStreamConfig.AppLevelPongTimeout: removed
SSEConfig.AppLevelPingInterval: removed
SSEConfig.AppLevelPongTimeout: removed
SockjsConfig.AppLevelPingInterval: removed
SockjsConfig.AppLevelPongTimeout: removed
WebsocketConfig.AppLevelPingInterval: removed
WebsocketConfig.AppLevelPongTimeout: removed
## compatible changes
(*Client).ChannelsWithContext: added
(*RedisBroker).Close: added
(*RedisPresenceManager).Close: added
(*RedisShard).Close: added
ChannelContext: added
HTTPStreamConfig.PingInterval: added
HTTPStreamConfig.PingPongConfig: added
HTTPStreamConfig.PongTimeout: added
PingPongConfig: added
SSEConfig.PingInterval: added
SSEConfig.PingPongConfig: added
SSEConfig.PongTimeout: added
SockjsConfig.PingInterval: added
SockjsConfig.PingPongConfig: added
SockjsConfig.PongTimeout: added
SubscribeOptions.Source: added
WebsocketConfig.PingPongConfig: added
WithSubscribeSource: added
# summary
v0.26.0 is a valid semantic version for this release.
Full Changelog: v0.25.0...v0.26.0
v0.25.0
Breaking changes
This release enables using client protocol v2 by default. Here is a list of SDKs compatible with new client protocol iteration:
- centrifuge-js >= v3.0.0
- centrifuge-go >= v0.9.0
- centrifuge-dart >= v0.9.0
- centrifuge-swift >= v0.5.0
- centrifuge-java >= v0.2.0
All SDKs in Centrifugal ecosystem mentioned above now behave 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.
This means:
- WebSocket handler will assume client connects over protocol v2. But we will still support client protocol v1 for some time (I believe half a year at least). Protocol v1 may be forced using
WebsocketConfig.ProtocolVersion
option (set it toProtocolVersion1
). Or client can provide?cf_protocol_version=v1
in connection URL. Applications can smoothly migrate to new protocol, for example, see how Centrifugo v4 migration guide provides steps to migrate apps to new client protocol. - The same applies to SockJS handler. SockJS is now DEPRECATED in Centrifugal ecosystem (we provide our own WebSocket emulation layer, which is faster, does not require sticky sessions, has less overhead in terms of network traffic and memory usage on server side)
- All examples in this repo were adapted to use the latest client SDK API which works according to new client SDK spec
- Unidirectional transport examples were also updated and now use client protocol v2
- New SDKs that work with new client protocol will be released in parallel with Centrifuge v0.25.0 and Centrifugo v4
To summarise:
- Current SDKs will be able to work with Centrifuge v0.25.0 – but you will need to turn on using client protocol v1 on server side. This way you can update server side without changing client side code.
- New client SDKs which will be released will only work with new iteration of client protocol
Please don't hesitate to join our Telegram and Discord communities in case of questions - we will try to help.
v0.24.0
This release has some adjustments required for Centrifugo v4.
Please take a look at example below which emphasizes the important migration step of your server-side code regarding join/leave messages.
We are not switching to client protocol v2 here yet (in v0.23.0 we mentioned it could be the part of the next minor release, but turned out we need an additional intermediate step before we can do the switch).
- change subscribe option names to be more meaningful
- support asking for join/leave messages from the client side
- send initial ping with random delay in client protocol v2 to smooth syscalls (and thus a CPU usage) after a massive reconnect scenario
- make
client.handleCommand
public (client.HandleCommand
) to have a possibility to handle protocol commands when decoding happens on Transport layer - fix SSEHandler default max body size (used in case of POST requests)
The important thing is that SubscribeOptions
now have 2 flags related to join/leave messages: SubscribeOptions.EmitJoinLeave
and SubscribeOptions.PushJoinLeave
. This means the program like this:
client.OnSubscribe(func(e centrifuge.SubscribeEvent, cb centrifuge.SubscribeCallback) {
cb(centrifuge.SubscribeReply{
Options: centrifuge.SubscribeOptions{
JoinLeave: true,
},
}, nil)
})
Must be replaced with this code to inherit the previous behavior:
client.OnSubscribe(func(e centrifuge.SubscribeEvent, cb centrifuge.SubscribeCallback) {
cb(centrifuge.SubscribeReply{
Options: centrifuge.SubscribeOptions{
EmitJoinLeave: true,
PushJoinLeave: true,
},
}, nil)
})
I.e. we tell Centrifuge that it should emit join/leave messages for a particular channel subscription, and it should send (push) join/leave messages to this particular client connection. The same applies to server-side subscriptions also, see how we adopted our own examples in repo in #233 where the change was introduced.
gorelease -base v0.23.1 -version v0.24.0
# github.com/centrifugal/centrifuge
## incompatible changes
SubscribeOptions.JoinLeave: removed
SubscribeOptions.Position: removed
SubscribeOptions.Presence: removed
SubscribeOptions.Recover: removed
WithJoinLeave: removed
WithPosition: removed
WithPresence: removed
WithRecover: removed
## compatible changes
(*Client).HandleCommand: added
SubscribeEvent.JoinLeave: added
SubscribeOptions.EmitJoinLeave: added
SubscribeOptions.EmitPresence: added
SubscribeOptions.EnablePositioning: added
SubscribeOptions.EnableRecovery: added
SubscribeOptions.PushJoinLeave: added
WithEmitJoinLeave: added
WithEmitPresence: added
WithPositioning: added
WithPushJoinLeave: added
WithRecovery: added
# summary
v0.24.0 is a valid semantic version for this release.
v0.23.1
v0.23.0
This release is a work concentrated around two main things:
- More work on client protocol v2. This should become part of Centrifugo v4. New SDKs which work over new protocol and have new API will be soon released. SDKs will behave according to client SDK API spec. Probably in next major release of Centrifuge we will switch using protocol v2 by default. For now things should be backwards compatible with current protocol.
- Introducing our own EXPERIMENTAL bidirectional emulation layer using HTTP-streaming and EventSource transports. There are a couple of examples which demonstrate how to use it. Examples located in
_examples/experimental
directory (they require newcentrifuge-js
SDK served locally from v3_dev branch). The important thing about our emulation implementation is that it does not require sticky sessions on load balancer in distributed case. This should be a more lightweight alternative to SockJS, and the cool thing is that our new Javascript SDK will be able to automatically fallback to HTTP-based transports in case of problems with WebSocket connection. More information will be available soon upon Centrifugo v4 release.
Lots of changes here but in most cases it should be straightforward to adapt. Don't hesitate to reach out with questions in community chat rooms.
Some important release highlights:
DefaultConfig
removed, useConfig{}
as a starting point. I.e.centrifuge.New(centrifuge.Config{})
is equivalent tocentrifuge.New(centrifuge.DefaultConfig)
.- We are avoiding using pointers for Disconnects. We got rid of nil Disconnect inside
OnDisconnect
callback when connection closing was not forced by a server. Where we previously hadnil
we now always haveDisconnectConnectionClosed
. This should make library usage more safe and better describes the reason of disconnection. - Refactor unsubscribe reasons, make unsubscribe first-class citizen with unsubscribe codes.
- Introducing
Temporary
flag forError
to indicate temporary errors to a client. This allows making Subscriptions more resilient in client protocol v2 - subscriptions will re-subscribe automatically upon receiving temporary errors. - There are updated rules in code numbers used for errors, unsubscribes and disconnects. This allows splitting code number space and avoid code overlap. While these rules may be tricky to follow – we believe that in most cases library users do not deal with them a lot in application code:
- For errors: error codes must be in range [0, 1999]. Codes [0, 99] are reserved for client-side errors. Codes [100, 399] are reserved for Centrifuge library internal usage. So applications must use codes in range [400, 1999] when creating custom errors.
- For unsubscribe codes: codes must be in range [2000, 2999]. Unsubscribe codes >= 2500 coming from server to client result into resubscribe attempt in client protocol V2. Codes [2000, 2099] and [2500, 2599] are reserved for Centrifuge library internal usage. In client protocol v2 we are making Subscriptions to behave isolated from Connection. For example, some individual subscriptions can expire, but it does not result into connection close, only that individual Subscription will re-subscribe if required.
- For disconnect codes: codes must be in range [3000, 4999]. Codes [3000, 3999] are reserved for Centrifuge library internal usage. Upon receiving disconnect code in range [3000, 3499] or [4000, 4499] client won't reconnect to a server. Splitting disconnect codes to ranges allows getting rid of sending JSON-encoded data in WebSocket CLOSE frame in client protocol v2. Thus – less network traffic and more lightweight disconnection process.
OnStateSnapshot
callback for connection to return Client current state to the external code, useful for connection introspection. This is EXPERIMENTAL and a subject to change.- Remove an unnecessary lock - #230
As you can see many changes in this release are concentrated around making library more strict in some aspects, this is a part of standardization and unifying client protocol and SDK API/behavior we want to achieve.
❯ gorelease -base v0.22.2 -version v0.23.0
# github.com/centrifugal/centrifuge
## incompatible changes
(*Client).Disconnect: changed from func(*Disconnect) to func(...Disconnect)
(*Client).Unsubscribe: changed from func(string) error to func(string, ...Unsubscribe)
DefaultConfig: removed
DisconnectBadRequest: changed from *Disconnect to Disconnect
DisconnectChannelLimit: changed from *Disconnect to Disconnect
DisconnectConnectionLimit: changed from *Disconnect to Disconnect
DisconnectEvent.Disconnect: changed from *Disconnect to Disconnect
DisconnectExpired: changed from *Disconnect to Disconnect
DisconnectForceNoReconnect: changed from *Disconnect to Disconnect
DisconnectForceReconnect: changed from *Disconnect to Disconnect
DisconnectInsufficientState: changed from *Disconnect to Disconnect
DisconnectInvalidToken: changed from *Disconnect to Disconnect
DisconnectNoPong: changed from *Disconnect to Disconnect
DisconnectNormal: removed
DisconnectServerError: changed from *Disconnect to Disconnect
DisconnectShutdown: changed from *Disconnect to Disconnect
DisconnectSlow: changed from *Disconnect to Disconnect
DisconnectStale: changed from *Disconnect to Disconnect
DisconnectSubExpired: changed from *Disconnect to Disconnect
DisconnectWriteError: changed from *Disconnect to Disconnect
Error.Error: removed
Hub: old is comparable, new is not
Transport.Close: changed from func(*Disconnect) error to func(Disconnect) error
TransportInfo.Emulation: added
UnsubscribeEvent.Reason: removed
UnsubscribeReason: removed
UnsubscribeReasonClient: removed
UnsubscribeReasonDisconnect: removed
UnsubscribeReasonServer: removed
WithDisconnect: removed
## compatible changes
(*Client).OnStateSnapshot: added
(*Client).StateSnapshot: added
(*Disconnect).CloseText: added
(*Hub).Connections: added
Disconnect.Error: added
Disconnect.String: added
DisconnectConnectionClosed: added
DisconnectEvent.Code: added
DisconnectEvent.Reason: added
DisconnectEvent.Reconnect: added
EmulationConfig: added
EmulationHandler: added
Error.Temporary: added
HTTPStreamConfig: added
HTTPStreamHandler: added
NewEmulationHandler: added
NewHTTPStreamHandler: added
NewSSEHandler: added
SSEConfig: added
SSEHandler: added
StateSnapshotHandler: added
SubscribeEvent.Positioned: added
SubscribeEvent.Recoverable: added
Unsubscribe.String: added
Unsubscribe: added
UnsubscribeCodeClient: added
UnsubscribeCodeDisconnect: added
UnsubscribeCodeExpired: added
UnsubscribeCodeInsufficient: added
UnsubscribeCodeServer: added
UnsubscribeEvent.Code: added
UnsubscribeEvent.Unsubscribe: added
WithCustomDisconnect: added
WithCustomUnsubscribe: added
# summary
v0.23.0 is a valid semantic version for this release.