Skip to content

Conversation

@RangelReale
Copy link
Contributor

Following this issue comment, I implemented a generic callback for all types of connection events.

Fixes #579

[NOTIFICATION] connecting (isReconnect=false) [0]
[NOTIFICATION] broker connection: tcp://127.0.0.1:1883
[NOTIFICATION] broker connection failed: dial tcp 127.0.0.1:1883: connect: connection refused [tcp://127.0.0.1:1883]
[NOTIFICATION] connection failed: network Error : dial tcp 127.0.0.1:1883: connect: connection refused
[NOTIFICATION] connecting (isReconnect=false) [1]
[NOTIFICATION] broker connection: tcp://127.0.0.1:1883
[NOTIFICATION] broker connection failed: dial tcp 127.0.0.1:1883: connect: connection refused [tcp://127.0.0.1:1883]
[NOTIFICATION] connection failed: network Error : dial tcp 127.0.0.1:1883: connect: connection refused
[NOTIFICATION] connecting (isReconnect=false) [2]
[NOTIFICATION] broker connection: tcp://127.0.0.1:1883
[NOTIFICATION] connected
TOPIC: go-mqtt/sample
MSG: this is msg #0!
TOPIC: go-mqtt/sample
MSG: this is msg #1!
TOPIC: go-mqtt/sample
MSG: this is msg #2!
TOPIC: go-mqtt/sample
MSG: this is msg #3!
TOPIC: go-mqtt/sample
MSG: this is msg #4!
[NOTIFICATION] connecting (isReconnect=true) [0]
[NOTIFICATION] broker connection: tcp://127.0.0.1:1883
[NOTIFICATION] connection lost: EOF
[NOTIFICATION] broker connection failed: dial tcp 127.0.0.1:1883: connect: connection refused [tcp://127.0.0.1:1883]
[NOTIFICATION] connection failed: network Error : dial tcp 127.0.0.1:1883: connect: connection refused
[NOTIFICATION] connecting (isReconnect=true) [1]
[NOTIFICATION] broker connection: tcp://127.0.0.1:1883
[NOTIFICATION] broker connection failed: dial tcp 127.0.0.1:1883: connect: connection refused [tcp://127.0.0.1:1883]
[NOTIFICATION] connection failed: network Error : dial tcp 127.0.0.1:1883: connect: connection refused
[NOTIFICATION] connecting (isReconnect=true) [2]
[NOTIFICATION] broker connection: tcp://127.0.0.1:1883
[NOTIFICATION] broker connection failed: dial tcp 127.0.0.1:1883: connect: connection refused [tcp://127.0.0.1:1883]
[NOTIFICATION] connection failed: network Error : dial tcp 127.0.0.1:1883: connect: connection refused
[NOTIFICATION] connecting (isReconnect=true) [3]
[NOTIFICATION] broker connection: tcp://127.0.0.1:1883
[NOTIFICATION] connected

@MattBrittan MattBrittan merged commit d276593 into eclipse-paho:master Sep 16, 2025
1 check passed
@MattBrittan
Copy link
Contributor

Thanks for this.

algitbot pushed a commit to alpinelinux/build-server-status that referenced this pull request Nov 9, 2025
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/eclipse/paho.mqtt.golang](https://github.com/eclipse/paho.mqtt.golang) | require | patch | `v1.5.0` -> `v1.5.1` |

---

### Release Notes

<details>
<summary>eclipse/paho.mqtt.golang (github.com/eclipse/paho.mqtt.golang)</summary>

### [`v1.5.1`](https://github.com/eclipse-paho/paho.mqtt.golang/releases/tag/v1.5.1)

[Compare Source](eclipse-paho/paho.mqtt.golang@v1.5.0...v1.5.1)

This is a minor release incorporating changes made in the 14 months since v1.5.0 (including updating dependencies, and raising the Go version to 1.24). The changes are relatively minor but address a potential security issue, possible panic, enable users to better monitor the connection status, and incorporate a few optimisations.

Thanks to those who have provided fixes/enhancements included in this release!

Special thanks to Paul Gerste at [Sonar](https://www.sonarsource.com/) for reporting issue [#&#8203;730](eclipse-paho/paho.mqtt.golang#730) via the Eclipse security team (fix was implemented in MR [#&#8203;714](eclipse-paho/paho.mqtt.golang#714) in May, github issue created just prior to this release). This issue arose where a topic > 65535 bytes was passed to the `Publish` function, due to the way the data was encoded the topic could leak into the message body. Please see issue [#&#8203;730](eclipse-paho/paho.mqtt.golang#730) for further details.

#### What's Changed

- Updating go dependencies from pub and sub into the containers before building by [@&#8203;JefJrFigueiredo](https://github.com/JefJrFigueiredo) in [eclipse-paho#691](eclipse-paho/paho.mqtt.golang#691)
- Optimize TCP connection logic by [@&#8203;geekeryy](https://github.com/geekeryy) in [eclipse-paho#713](eclipse-paho/paho.mqtt.golang#713)
- Fields over 65535 bytes not encoded correctly by [@&#8203;MattBrittan](https://github.com/MattBrittan) in [eclipse-paho#714](eclipse-paho/paho.mqtt.golang#714)
- Reduce slice allocations in route dispatch  by [@&#8203;alespour](https://github.com/alespour) in [eclipse-paho#710](eclipse-paho/paho.mqtt.golang#710)
- Add a ConnectionNotificationHandler by [@&#8203;RangelReale](https://github.com/RangelReale) in [eclipse-paho#727](eclipse-paho/paho.mqtt.golang#727)
- Potential panic when using manual ACK by [@&#8203;MattBrittan](https://github.com/MattBrittan) in [eclipse-paho#729](eclipse-paho/paho.mqtt.golang#729)

**Full Changelog**: <eclipse-paho/paho.mqtt.golang@v1.5.0...v1.5.1>

</details>

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

&nbsp;
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNzMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE3My4xIiwidGFyZ2V0QnJhbmNoIjoibWFzdGVyIiwibGFiZWxzIjpbXX0=-->

See merge request alpine/infra/build-server-status!22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

can you add connect fail Handler,reconnect fail Handler ? thanks

2 participants