View examples for:


On this page:

# Publishing messages

All pub/sub messages in Diffusion are sent as an update to specific topics. Topics have unique names (otherwise referred to as topic paths), and can be added or removed dynamically. Topics work as a way of grouping and filtering the data that individual applications are sent, by allowing clients to select which topics to receive updates from.

Each topic can have an arbitrary number of subscribers; publishers can update topics even if there are no subscribers, and clients can pre-emptively subscribe to topic paths that don't yet exist.

# Creating a topic

You can create a topic via a client SDK or the REST API

TIP

Adding topics is idempotent - that is, adding a topic to the same path as one that already exists will succeed (as long as the topic properties are the same).

# Publishing to a topic

Now you have created a topic, you can publish an update to give it a value.

TIP

Topics must exist before you can publish to them!