{"id":37118096,"url":"https://github.com/lynnplus/go-mqtt","last_synced_at":"2026-01-14T13:48:18.686Z","repository":{"id":238083839,"uuid":"795835041","full_name":"lynnplus/go-mqtt","owner":"lynnplus","description":"mqtt client for golang","archived":false,"fork":false,"pushed_at":"2024-05-14T07:41:32.000Z","size":159,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-19T11:23:12.361Z","etag":null,"topics":["mqtt","mqtt-client","mqttv3","mqttv5"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lynnplus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-04T07:38:33.000Z","updated_at":"2024-05-15T17:39:52.000Z","dependencies_parsed_at":"2024-06-19T11:19:28.051Z","dependency_job_id":"e366f342-6ba3-4532-bbdc-1bd6bdb9b132","html_url":"https://github.com/lynnplus/go-mqtt","commit_stats":null,"previous_names":["lynnplus/go-mqtt"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lynnplus/go-mqtt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnplus%2Fgo-mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnplus%2Fgo-mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnplus%2Fgo-mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnplus%2Fgo-mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lynnplus","download_url":"https://codeload.github.com/lynnplus/go-mqtt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lynnplus%2Fgo-mqtt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28422343,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T13:30:50.153Z","status":"ssl_error","status_checked_at":"2026-01-14T13:29:08.907Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mqtt","mqtt-client","mqttv3","mqttv5"],"created_at":"2026-01-14T13:48:18.112Z","updated_at":"2026-01-14T13:48:18.665Z","avatar_url":"https://github.com/lynnplus.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-mqtt\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/lynnplus/go-mqtt.svg)](https://pkg.go.dev/github.com/lynnplus/go-mqtt)\n![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/lynnplus/go-mqtt)\n![GitHub tag (with filter)](https://img.shields.io/github/v/tag/lynnplus/go-mqtt)\n[![Go Report Card](https://goreportcard.com/badge/github.com/lynnplus/go-mqtt)](https://goreportcard.com/report/github.com/lynnplus/go-mqtt)\n[![GitHub](https://img.shields.io/github/license/lynnplus/go-mqtt)](https://github.com/lynnplus/go-mqtt/blob/master/LICENSE)\n\n\ngo-mqtt is a mqtt golang client that implements the mqttv3 and mqttv5 protocols\n\n## Done\n- basic client\n- packet reading and writing\n- publish qos 0\n- subscribe and unsubscribe\n- re-connector\n## TODO\n- mqttv3 check\n- qos 1 and 2\n- prefix tree based message router\n- event hook\n\n## Links\n\n[MQTT-v5.0 oasis doc](https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html)\n\n[MQTT-v3.1.1 oasis doc](https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html)\n\n## How to use\n\nget package:\n```shell\ngo get github.com/lynnplus/go-mqtt\n```\nconnect to mqtt broker\n```go\npackage main\n\nimport (\n\t\"github.com/lynnplus/go-mqtt\"\n\t\"github.com/lynnplus/go-mqtt/packets\"\n)\n\nfunc main() {\n\tclient := mqtt.NewClient(\u0026mqtt.ConnDialer{\n\t\tAddress: \"tcp://127.0.0.1:1883\",\n\t}, mqtt.ClientConfig{})\n\n\tpkt := packets.NewConnect(\"client_id\", \"username\", []byte(\"password\"))\n\tack, err := client.Connect(context.Background(), pkt)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tif ack.ReasonCode != 0 {\n\t\tpanic(packets.NewReasonCodeError(ack.ReasonCode, \"\"))\n\t}\n\t//do something\n\t_ = client.Disconnect()\n}\n```\n\nThe package provides two connection methods,\nsynchronous and asynchronous. When asynchronous,\nthe response result can only be obtained in the callback.\n\nAsynchronous call connection:\n\n```go\npackage main\n\nfunc main() {\n\tclient := mqtt.NewClient(\u0026mqtt.ConnDialer{\n\t\tAddress: \"tcp://127.0.0.1:1883\",\n\t}, mqtt.ClientConfig{\n\t\tOnConnected: func(c *mqtt.Client, ack *packets.Connack) {\n\t\t\tfmt.Println(ack.ReasonCode)\n\t\t},\n\t})\n\tpkt := packets.NewConnect(\"client_id\", \"username\", []byte(\"password\"))\n\terr := client.StartConnect(context.Background(), pkt)\n}\n```\n\nFor a basic chat example please see: https://github.com/lynnplus/go-mqtt/blob/master/examples/chat/main.go\n\n## Features\n\n### Dialer\nThe package provides a dialer that implements tcp and tls by default.\nIf the user needs other connection protocol support, such as websocket,\nthe Dialer interface provided in the package can be implemented.\n\n### MQTTv5 Enhanced authentication\n- scram : [example](https://github.com/lynnplus/go-mqtt/blob/master/auther.go)\n\n### Re-connect\n\n...\n\n### Router\n\n...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flynnplus%2Fgo-mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flynnplus%2Fgo-mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flynnplus%2Fgo-mqtt/lists"}