The Feeds Model
Each instance of the Feeds service contains multiple feeds, and each feed is an ordered list of items. Items are published to the feed from your server and are cached on the feeds servers.
Clients (the browser) can subscribe to feeds, and will receive any items published to that feed in realtime. They can also receive a number of previously published items -- configurable on subscribe. Each item consists of:
- Item ID: a monotonically increasing number
- Timestamp: when the item was published in nanoseconds
- Data: an arbitrary JSON structure
This diagram gives a more detailed overview of the architecture:
Feeds are created lazily: you can publish items to feeds that do not exist yet. You can also subscribe to feeds that have never been published to. This allows you to easily create feeds dynamically, for example if you want a feed per-user.
Feed IDs must be alpha-numeric and can contain dashes (
-). The regex used to validate them is
Feed items are immutable: after publishing an item, that item stays the same until it is removed from the feed. There are two ways items can be removed:
- When the total number of items across all feeds in an instance reaches 10,000: each new publish pushes out the oldest item in the instance.
- When a feed is deleted in its entirety via the server SDK or dashboard.
Because old feed items get pushed out by new ones, you should treat the feed as a buffer, or a cache. Apps requiring a complete item history should store a separate archive.
Feeds also supports private feeds, which allow you to restrict read access (subscribes and queries) from the client.