MQTT 3.1.1 · MQTT 5.0 · TLS/SSL Support

MQTT Mock Broker

Test IoT applications without a real MQTT broker. Simulate device communication, topic subscriptions, and pub/sub messaging. Works offline, no rate limits.

Full MQTT Protocol Support

Everything you need to mock MQTT broker behavior for development and testing.

Device Simulation

Simulate multiple IoT devices publishing and subscribing to topics. Test device behavior without physical hardware.

Topic Subscriptions

Full wildcard support with + and # patterns. Subscribe to sensor/+/temperature or home/# for flexible matching.

Pub/Sub Messaging

Bidirectional message flow simulation. Publish messages and receive responses on subscribed topics.

Message Filtering

Match incoming messages by topic pattern, payload content, or client ID. Route responses based on message attributes.

QoS Level Support

Configure Quality of Service levels 0, 1, and 2. Test delivery guarantees and acknowledgment flows.

Retained Messages

Simulate retained message behavior. New subscribers receive the last retained message on subscription.

Simple Configuration

Define topic subscriptions, response templates, and retained messages in a clean YAML format. Use wildcards for flexible topic matching and template variables for dynamic responses.

  • Topic wildcards: Use + and # for flexible matching
  • Capture groups: Extract topic segments as $1, $2, etc.
  • JSONPath matching: Filter messages by payload content
  • Template helpers: Timestamps, random values, UUIDs
mqtt-mock.yaml
# mockd.yaml - MQTT Mock Configuration
mocks:
  - id: mqtt-broker
    type: mqtt
    mqtt:
      port: 1883
      auth:
        enabled: true
        users:
          - username: device
            password: secret123
            acl:
              - topic: "sensors/#"
                access: publish
              - topic: "commands/#"
                access: subscribe
      topics:
        - topic: sensors/temperature
          qos: 1
          retain: true
          messages:
            - payload: |
                {"deviceId": "temp_001",
                 "value": 22,
                 "unit": "celsius",
                 "timestamp": "{{now}}"}
              interval: "5s"
              repeat: true
        - topic: commands/+
          qos: 1
          onPublish:
            response:
              payload: |
                {"status": "acknowledged",
                 "timestamp": "{{now}}"}
        - topic: sensors/{device_id}/telemetry
          qos: 1
          deviceSimulation:
            enabled: true
            deviceCount: 5
            deviceIdPattern: "device_{index}"

Built for IoT Development

From smart home apps to industrial automation. Mockd handles your MQTT testing needs.

IoT Device Testing

Test sensor data flows, device commands, and telemetry pipelines without deploying to real hardware.

Home Automation

Develop smart home apps with mocked light switches, thermostats, and security sensors.

Industrial IoT

Simulate factory floor sensors, PLCs, and SCADA systems for industrial application development.

Mobile App Backend

Mock MQTT backends for iOS and Android apps. Test push notifications and real-time updates.

Why Mockd vs Public Test Brokers?

Public brokers like test.mosquitto.org and HiveMQ are great for quick tests, but Mockd gives you complete control for serious development.

FeaturePublic BrokersMockd
Rate limits
Strict limits, shared resources
No limits, full throughput
Offline support
Requires internet
Works completely offline
Response control
Unpredictable timing
Deterministic, configurable delays
Message inspection
Limited visibility
Full message logging & replay
Custom behavior
No customization
Programmable responses
Privacy
Data on public servers
All data stays local

Start Mocking MQTT in Minutes

Single Go binary. No dependencies. Connect your MQTT clients and start testing.

# Start the mock server
mockd init && mockd up