Just a second...

Receiving data from topics

A client can subscribe to a topic to receive a stream of updates or can fetch the current state of a topic.


A topic is a logical channel through which data can be distributed to clients. Topics provide a logical link between publishing clients and subscribing clients.

Diffusion™ Cloud provides different types of topic that can be used to stream diffent data formats or can be used for special purposes. For more information about topic types and uses, see Topics.


To receive data published to a topic as a stream of updates, a client takes the following actions:
  • Subscribe to a topic or set of topics.
  • Register a stream that matches the topic or set of topics, or register a matching fallback stream.
For topics that exist and that the client is subscribed to, data is received through a stream that is registered against that topic - if one exists and is of the appropriate type.
Note: The subscription flow is fully described in the design section of the documentation. For more information, see Subscribing to topics.


To fetch the current value of a topic or set of topics, a client makes a fetch request, passing in a fetch stream, and uses the fetch stream to receive the data.


Clients use streams to receive data from topics.
Figure 1. A stream A client makes a call, passing a reference to a stream object. The server responds by calling a method on the stream object. A stream object can have its methods called multiple times during its lifetime. When a stream object's onClose method is called the stream is closed and it can no longer receive responses on any of its other methods.
Streams are API objects that can receive multiple calls from Diffusion Cloud on the same method while the stream is open. After the stream is closed or discarded, it can no longer receive responses on any of its other methods.