{"id":20078514,"url":"https://github.com/amenzhinsky/mqtt","last_synced_at":"2025-08-11T21:35:58.975Z","repository":{"id":57488363,"uuid":"203982835","full_name":"amenzhinsky/mqtt","owner":"amenzhinsky","description":"Micro MQTT library for Golang","archived":false,"fork":false,"pushed_at":"2019-12-10T07:17:49.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-02T13:14:22.321Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amenzhinsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-23T11:07:29.000Z","updated_at":"2019-12-10T07:17:51.000Z","dependencies_parsed_at":"2022-08-29T13:31:49.027Z","dependency_job_id":null,"html_url":"https://github.com/amenzhinsky/mqtt","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/amenzhinsky/mqtt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amenzhinsky%2Fmqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amenzhinsky%2Fmqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amenzhinsky%2Fmqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amenzhinsky%2Fmqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amenzhinsky","download_url":"https://codeload.github.com/amenzhinsky/mqtt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amenzhinsky%2Fmqtt/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269962062,"owners_count":24504263,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-11T02:00:10.019Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-13T15:14:50.567Z","updated_at":"2025-08-11T21:35:58.920Z","avatar_url":"https://github.com/amenzhinsky.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mqtt\n\nMicro [MQTT 3.1.1](http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html) client for [Golang](https://golang.org/).\n\nIt provides low-level API and doesn't support async usage and advanced features such as reconnects, fallback addresses and persistent storage.\n\n## Usage\n\n```go\nconn, err := net.Dial(\"tcp\", \"127.0.0.1:8883\")\nif err != nil {\n\treturn err\n}\n\nclient := mqtt.New(conn, mqtt.WithMessagesHandler(func(pk *packet.Publish) {\n\tswitch {\n\tcase mqtt.Match(\"/dev/cmd/speed\", pk.Topic):\n\t\tspeed(binary.BigEndian.Uint32(pk.Payload))\n\tcase mqtt.Match(\"/dev/cmd/+/play\", pk.Topic):\n\t\tplay(strings.Split(pk.Topic, \"/\")[3], pk.Payload)\n\t}\n}))\ndefer client.Close()\n\nif _, err := client.Connect(context.Background(),\n\tpacket.WithConnectCleanSession(true),\n\tpacket.WithConnectWill(\"/dev/online\", []byte{0}, packet.QoS1, true),\n); err != nil {\n\treturn err\n}\n\nif _, err := client.Subscribe(context.Background(),\n\tpacket.WithSubscribeTopic(\"/dev/cmd/#\", packet.QoS1),\n); err != nil {\n\treturn err\n}\n\nif err := client.Publish(context.Background(),\n\t\"/dev/online\",\n\tpacket.WithPublishQoS(packet.QoS1),\n\tpacket.WithPublishPayload([]byte{1}),\n); err != nil {\n\treturn err\n}\n\nif err := client.Disconnect(context.Background()); err != nil {\n\treturn err\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famenzhinsky%2Fmqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famenzhinsky%2Fmqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famenzhinsky%2Fmqtt/lists"}