The Central Go Modules Repository

To use GoCenter:
export GOPROXY=
May 21st 2020
Last Modified

GoDoc Go Report Card

Eclipse Paho MQTT Go client

This repository contains the source code for the Eclipse Paho MQTT Go client library.

This code builds a library which enable applications to connect to an MQTT broker to publish messages, and to subscribe to topics and receive published messages.

This library supports a fully asynchronous mode of operation.

Installation and Build

This client is designed to work with the standard Go tools, so installation is as easy as:

go get

The client depends on Google’s proxy package and the websockets package, also easily installed with the commands:

go get
go get

Usage and API

Detailed API documentation is available by using to godoc tool, or can be browsed online using the service.

Make use of the library by importing it in your Go client source code. For example,

import ""

Samples are available in the cmd directory for reference.


The library also supports using MQTT over websockets by using the ws:// (unsecure) or wss:// (secure) prefix in the URI. If the client is running behind a corporate http/https proxy then the following environment variables HTTP_PROXY, HTTPS_PROXY and NO_PROXY are taken into account when establishing the connection.

Runtime tracing

Tracing is enabled by assigning logs (from the Go log package) to the logging endpoints, ERROR, CRITICAL, WARN and DEBUG

Reporting bugs

Please report bugs by raising issues for this project in github

More information

Discussion of the Paho clients takes place on the Eclipse paho-dev mailing list.

General questions about the MQTT protocol are discussed in the MQTT Google Group.

There is much more information available via the MQTT community site.