Skip to main content

Delta compression for at most once scenario

Centrifugo OSS supports delta compression only in channels with recovery and positioning on. To support delta compression for the case when subscribers do not use recovery and positioning Centrifugo PRO provides a boolean namespace option called keep_latest_publication. When it's on – Centrifugo saves latest publication in channels to node's memory and uses it to construct delta updates. The publication lives in node's memory while there are active channel subscribers. This allows dealing with at most once guarantee of Broker's PUB/SUB layer and send deltas properly. So you get efficient at most once broadcast and the reduced bandwidth (of course if delta compression makes sense for data in a channel).

All you need to do is enable keep_latest_publication for the desired namespace:

config.json
{
"namespaces": [
{
"name": "example",
"allowed_delta_types": ["fossil"],
"keep_latest_publication": true
}
]
}

Everything else stays the same as described in delta compression chapter:

  • clients need to negotiate delta compression when subscribing
  • publishers need to indicate the desire to use delta compression by using API delta field, or by using delta_publish channel namespace option.