What's Changed
New Features
-
Server-side publication filtering by tags, by @FZambia in #511.
Added support for filtering publications on the server by specifying tag filters in subscription requests. This feature may significantly help with bandwidth optimization for real-time messaging applications, particularly in scenarios where clients would otherwise receive and discard a significant portion of messages in a channel anyway. Not only network costs may be reduced in this case, but also processing overhead which leads to a faster battery drain on mobile devices.
See the example which shows stock tickers filtered server-side based on a client-supplied tags filter.
For more insights, read the recent post in Centrifugal blog: Publication filtering by tags – reducing bandwidth with server-side stream filtering. -
Experimental WebSocket over HTTP/2 (RFC 8441), by @FZambia in #519.
Initial support for WebSocket over HTTP/2 following RFC 8441. In that case each WebSocket connection is a separate HTTP/2 stream inside a single HTTP/2 connection. The feature may be useful for reducing connection latency (avoid TLS handshake overhead) or to reduce the number of physical TCP connections in the infrastructure. RequiresGODEBUG=http2xconnect=1to be used (see golang/go#53208).
Added new HTTP/2 examples that demonstrate the usage of feature and include demonstration of managing Centrifuge-based server behind Haproxy (which supports both RFC 8441 and HTTP/2 Cleartext for connection proxying).
See additional notes about it in Centrifugo docs: WebSocket over HTTP/2 (RFC 8441). -
Introduction of new official real-time SDK:
centrifuge-csharp
Early-stage rollout of our new official C# SDK, currently under active development. This will become our 7th officially maintained SDK in addition to Javascript, Go, Dart, Java, Swift and Python.
Repository: https://github.com/centrifugal/centrifuge-csharp -
SHA-1 generation offloading to Redis (for better FIPS compliance), by @FZambia in #522.
Support for delegating SHA-1 generation to Redis for environments requiring FIPS compliance (without performance overhead, because the loading of SHA-1 is only done once on the start). SeeRedisBrokerConfig.LoadSHA1andRedisPresenceManagerConfig.LoadSHA1. -
Experimental channel compaction, part of #511 PR
Some of our SDKs may now negotiate channel compaction feature - a way to reduce sending channels as full strings in the client protocol. If enabled on server side (seeSubscribeOptions.AllowChannelCompaction) then channel gets a numeric ID and represented in a more compact form in the client protocol. In Protobuf protocol it may be just a varint (1-10 bytes in the wire) instead of let's say 40-60 bytes channel string (of course this depends on how long channel strings are in your specific use case). This may allow reducing bandwidth significantly in some setups. Now supported only bycentrifuge-jsSDK. -
Metrics enhancements
SeeMetricsConfig.ExposeTransportAcceptProtocolflag to enable resolution by transport underlying protocol (h1,h2). We extendedTransportInfointerface withAcceptProtocolto support that.
Fixes & Maintenance
-
Deadlock prevention for single connections, by @FZambia in #515.
Resolved a potential deadlock involvingnode.Disconnectand striking more often when maintaining single connection (this was originally reported to Centrifugo, here we had example for it, it's now updated). -
CI lint updates and minor lint corrections, by @FZambia in #520.
Improvements to continuous integration linting setup and corresponding fixes. Using golang-ci lint v2 now. -
Dependency updates
General dependency refresh across the project.
❯ gorelease -base v0.37.2 -version v0.38.0
# github.com/centrifugal/centrifuge
## incompatible changes
TransportInfo.AcceptProtocol: added
## compatible changes
MetricsConfig.ExposeTransportAcceptProtocol: added
RedisBrokerConfig.LoadSHA1: added
RedisPresenceManagerConfig.LoadSHA1: added
SubscribeOptions.AllowChannelCompaction: added
SubscribeOptions.AllowTagsFilter: added
TransportAcceptedLabels: added
WebsocketConfig.DisableHTTP1Upgrade: added
Full Changelog: v0.37.2...v0.38.0