Connectivity

MQTTPublisher Block

Publishes incoming signal values to an MQTT broker over WebSockets on a specified topic.

Open MQTTPublisher in BlockWerk →

# MQTTPublisher Block

Description

MQTTPublisher is a sink block that forwards an incoming numeric signal to an MQTT broker over a WebSocket connection. During simulation, each time the input value changes, the block publishes it to the configured topic — throttled to a maximum of 50 Hz to conserve broker bandwidth.

Use this block to stream simulation outputs to external MQTT consumers: dashboards (e.g. Node-RED, Grafana), embedded controllers, or other BlockWerk instances subscribed to the same topic. The block displays live connection status and the current publish rate on the canvas.

Parameters

brokerUrl

WebSocket URL of the MQTT broker. Must start with ws:// or wss://. Default: ws://broker.hivemq.com:8000/mqtt.

topic

MQTT topic string to publish to. Default: /blockwerk/actuator1.

Examples

Stream a PID controller output to a physical actuator

PIDController → [out] ──► MQTTPublisher
                             brokerUrl: wss://my-broker.local:8884/mqtt
                             topic:     /plant/actuator/valve

Broadcast a generated sine wave to a monitoring dashboard

SineWave → [out] ──► MQTTPublisher
                       brokerUrl: ws://broker.hivemq.com:8000/mqtt
                       topic:     /blockwerk/monitor/sine

Remarks

See Also