{"id":21475093,"url":"https://github.com/snapp-incubator/pakhshi","last_synced_at":"2025-07-15T09:32:03.117Z","repository":{"id":51858175,"uuid":"364783795","full_name":"snapp-incubator/pakhshi","owner":"snapp-incubator","description":"handle multiple mqtt server/cluster based on paho client","archived":true,"fork":false,"pushed_at":"2025-02-17T08:05:50.000Z","size":64,"stargazers_count":24,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-12T08:53:05.225Z","etag":null,"topics":["go","golang","mqtt"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snapp-incubator.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}},"created_at":"2021-05-06T04:25:34.000Z","updated_at":"2025-02-17T08:06:07.000Z","dependencies_parsed_at":"2023-01-29T04:31:24.232Z","dependency_job_id":null,"html_url":"https://github.com/snapp-incubator/pakhshi","commit_stats":null,"previous_names":["1995parham/pakhshi"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/snapp-incubator/pakhshi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fpakhshi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fpakhshi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fpakhshi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fpakhshi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snapp-incubator","download_url":"https://codeload.github.com/snapp-incubator/pakhshi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snapp-incubator%2Fpakhshi/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265425320,"owners_count":23762900,"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","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":["go","golang","mqtt"],"created_at":"2024-11-23T10:37:09.610Z","updated_at":"2025-07-15T09:32:02.850Z","avatar_url":"https://github.com/snapp-incubator.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pakhshi\n\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/snapp-incubator/pakhshi/lint.yaml?label=lint\u0026logo=github\u0026style=flat-square\u0026branch=main)\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/snapp-incubator/pakhshi/test.yaml?label=test\u0026logo=github\u0026style=flat-square\u0026branch=main)\n[![Go Reference](https://pkg.go.dev/badge/github.com/snapp-incubator/pakhshi.svg)](https://pkg.go.dev/github.com/snapp-incubator/pakhshi)\n[![Codecov](https://img.shields.io/codecov/c/gh/snapp-incubator/pakhshi?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/snapp-incubator/pakhshi)\n\n## Introduction\n\nConsider you have an array of brokers but you want to publish and subscribe on all of them at the same time.\nWhy you may need this setup? consider clients are randomly distributed between available clusters and you don't want to check which client is connected to which\nbroker so you will publish on all cluster and your client is connected to one them.\n\n## How?\n\nThis library use [paho](https://github.com/eclipse/paho.mqtt.golang) in the background so you can easily change your applications to use this instead of paho.\nIt trying to implement all paho interfaces.\n\n## Examples\n\nThe following example shows how to subscribe on the same topic on two brokers.\n\n```go\nopts := mqtt.NewClientOptions()\nopts.AddBroker(\"tcp://127.0.0.1:1883\")\nopts.AddBroker(\"tcp://127.0.0.1:1884\")\n\nc := client.NewClient(opts)\n\nif token := c.Connect(); token.Wait() \u0026\u0026 token.Error() != nil {\n  assert.NoError(t, token.Error())\n}\n\nif token := c.Subscribe(\"hello\", 0, func(c mqtt.Client, m mqtt.Message) {\n  ch \u003c- string(m.Payload())\n}); token.Wait() \u0026\u0026 token.Error() != nil {\n  assert.NoError(t, token.Error())\n}\n```\n\n## Credits\n\nBased on idea of [Ahmad Anvari](https://github.com/anvari1313).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapp-incubator%2Fpakhshi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnapp-incubator%2Fpakhshi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnapp-incubator%2Fpakhshi/lists"}