MQTT is an Internet of Things connectivity protocol featuring a lightweight publish/subscribe messaging transport. It is useful for its small code footprint and minimal network bandwidth usage.

This repository contains the Gobot adaptor/drivers to connect to MQTT servers. It uses the Paho MQTT Golang client package ( created and maintained by the Eclipse Foundation ( thank you!

For more info about the MQTT machine to machine messaging standard, go to

API Reference

How to Install

Install running:

go get -d -u && go install

How to Use

Before running the example, make sure you have an MQTT message broker running somewhere you can connect to

package main

import (

func main() {
  mqttAdaptor := mqtt.NewAdaptor("tcp://", "pinger")

  work := func() {
    mqttAdaptor.On("hello", func(data []byte) {
    mqttAdaptor.On("hola", func(data []byte) {
    data := []byte("o")
    gobot.Every(1*time.Second, func() {
      mqttAdaptor.Publish("hello", data)
    gobot.Every(5*time.Second, func() {
      mqttAdaptor.Publish("hola", data)

  robot := gobot.NewRobot("mqttBot",


Supported Features

  • Publish messages
  • Respond to incoming message events


For our contribution guidelines, please go to


Copyright (c) 2013-2017 The Hybrid Group. Licensed under the Apache 2.0 license.


The MQTT does not have any drivers.