Subscription delivery modes

The subscriber can choose between different modes of delivery that determine how the data are transmitted to them. The delivery mode is defined by the subscriber upon their subscription request. Each subscriber of the same topic can decide which mode is best suited to their needs. All subscription delivery modes rely on an underlying SSE connection.

Snapshot + JSON Patch

In this mode, Streams sends, upon the initial connection, a full snapshot of the data fetched from the target API. Subsequent events only contain the changed fields in the form of an array of JSON Patch operations.

For example, in the context of a brokerage app, if a user subscribes to 10 different stock symbols, each symbol contains different fields such as identifier, last, bid, ask. But only a few of them really change at every market tick.

Streams computes the delta and sends the corresponding JSON patch operations to the subscriber, avoiding to resend fields that have not changed.

To enable this mode, the subscriber should add an Accept: application/json-patch+json header in its subscription request.

This is the default mode if no Accept header is provided in the subscription request. This mode can also be enabled with headers Accept: text/event-stream or Accept: */*.

Snapshot only

In this mode, Streams sends the entire updated content each time a change is detected in the content published to the topic. To use this mode, add the Accept: application/json header to the subscription request.

Use this mode for content which is rarely but fully updated.

Using application/json supersedes application/json-patch+json. Thus, subscribing with header Accept: application/json-patch+json, application/json enables Snapshot Only mode.

Related Links