Skip to main content
Version: Pro Edition for Eclipse Mosquitto 3.3

Publish & Subscribe

Publish & Subscribe is the in-browser MQTT test client for this broker. Open it from the broker sidebar under TOOLS. Use it to connect a client, subscribe to topics, publish payloads, and inspect received messages.

Publish & Subscribe landing

Open Publish & Subscribe​

  1. Open a project, then open a broker.
  2. In the broker sidebar under TOOLS, click Publish & Subscribe.

The page title is Publish & Subscribe. Until a client is connected, the page shows connection choices and the note You have to first connect your client to be able to publish and subscribe.

Connect a temporary client​

The fastest way to try the page is to create a temporary Dynamic Security client and connect it:

  1. Click Create temporary client and connect.
  2. Wait until the button changes to Disconnect and the client fields show a username such as pf_pubsub_….
Connected temporary client
note

Temporary clients are created for this session. Prefer them for quick tests so you do not need an existing password. For production-style tests, use a real client account with the right ACLs (see below).

Connect with a selected client​

To connect as an existing Dynamic Security client:

  1. Click Select existing client.
  2. Choose a client from Client (or type a username if no clients are listed).
  3. Optionally set Client ID.
  4. Enter the client Password.
  5. Click Connect.
Select existing client

When the session is up, the button changes to Disconnect and the selected username stays in Client.

Connected with selected client
note

The client must have a password set and roles/ACLs that allow the topics you subscribe to and publish on. Not authorized errors usually mean the role or ACLs need adjustment under Client Accounts or Client Roles. Optional Advanced settings (TLS certificate, protocol, port, CA) are available on this form when you need them. On a narrow connection row the Advanced label is shortened with an ellipsis.

Subscribe to a topic​

With a connected client:

  1. Enter a topic in Subscribe (for example docs/pubsub/test).
  2. Optionally set QoS (0, 1, or 2).
  3. Click Subscribe.

The topic appears under Subscribed Topics. A long topic name is shortened with an ellipsis; hover it to read the full name. Incoming messages for that subscription appear under Payloads.

Subscribed to a topic

You can also use Subscribe to all topics (#) when that option is available and not blocked by platform settings.

Publish a message​

  1. Under Publish New Message, enter the topic in Publish to (for example docs/pubsub/test).
  2. Enter a Payload (raw text or JSON).
  3. Optionally enable Retain and set QoS.
  4. Click Publish to. The button shows a send icon. When the publish page is narrower than 900px, only that icon is shown.

On success, the platform shows Message to Topic: "…" was published! The message appears under Published Messages. If you are subscribed to the same topic, it also appears under Payloads.

Published message and payloads

Wildcards (#, +) are not allowed in publish topics.

Inspect subscribed payloads​

Format JSON and Show History sit on the right of the Payloads heading. They apply to the topic selected under Subscribed Topics. The same controls are in the subscription monitor overlay.

Format JSON​

Format JSON appears after at least one payload on the selected subscription is JSON. It is on by default.

  • Checked: JSON is indented so it is easier to read.
  • Cleared: the payload is shown exactly as it was received.
Formatted JSON payload

Show History​

Show History appears when a payload is a number, or when JSON contains numeric fields. It is off by default.

To build a short history, use the Sensor Data template:

  1. Under Publish New Message, open Template and choose Sensor Data. The payload switches to JSON. humidity starts at 65.
  2. Set Publish to to the subscribed topic.
  3. Change humidity, then click Publish to.
  4. Publish once more with a different humidity. After each publish the template fills the payload again, so set the new value before the second publish.

Check Show History. A payload history chart opens beside the payload list. Payload fields for charts includes humidity. Chart settings adjusts the line, area fill, point labels, and horizontal grid. Clear Show History to hide the chart.

Payload history chart for sensor humidity

Select a topic from the Topic Tree​

Instead of typing a publish topic, you can pick one from the broker’s live Topic Tree:

  1. Click the Publish to field so it is focused.
  2. A Topic Tree popover opens under (or above) the field, with Published Topics and Subscribed Topics.
  3. Expand path segments as needed, then click a topic row.

The selected topic fills Publish to, and the popover closes. Enter a payload and click Publish to as usual.

Topic Tree selection on Publish to

Subscription monitor overlay​

While at least one topic is subscribed, the broker header shows a button such as 1 Subscription (or N Subscriptions).

  1. Click 1 Subscription (or N Subscriptions).
  2. The button label changes to Hide. A panel opens on the right, directly under the app bar, with the active client name, Disconnect, Subscribed Topics, and Payloads.
Subscription monitor overlay

The panel stays available as you move to other broker pages (for example Home), so you can keep watching payloads without staying on Publish & Subscribe. Click Hide to close it. When the last subscription is removed, the button disappears and the panel closes.

Disconnect​

Click Disconnect to close the MQTT session. The button includes a link-off icon. When the publish page is narrower than 900px, only that icon is shown. Publish and subscribe controls return to the disconnected state. You can connect again with Create temporary client and connect or Select existing client.

note

If the page cannot reach a public broker connection, follow Go to settings on the error and fix the connection on broker Home. Not authorized errors usually mean the client role or ACLs need adjustment under Client Accounts / Roles.