Gridsense Docs iconGridsense Docs

Topic structure

Understand how topics are constructed and how to customize them to your needs

Topic structure

In order for messages to be published to a specific channel and be associated with it, topics must begin with a special value:

m/<organization>/c/<channel>

where <organization> and <channel> are the IDs of the organization and channel respectively. Alternatively, the routes of the organization and channel can be used instead.

This serves as the bare minimum value that is accepted as a topic, which ensures the hierarchy of organizations and channels is respected, and as a result, that publishing to and reading from channels works as expected and that the dashboards you build and the widgets used in them accurately read and display data.

Subtopics

The main topic can be built upon to construct more granular topics, also referred to as subtopics. To publish and/or subscribe to a subtopic, simply append the subtopic to the end of the main topic:

m/<organization>/c/<channel>/subtopic

Subtopics can also be nested, with a forward-slash / separating every two levels:

m/<organization>/c/<channel>/subtopic/nested_subtopic[/...]

Adjacent forward-slashes are discarded to flatten the topic. This means the following two topics are equivalent:

m/<organization>/c/<channel>/subtopic/nested_subtopic////another_subtopic
m/<organization>/c/<channel>/subtopic/nested_subtopic/another_subtopic

On this page