server icon indicating copy to clipboard operation
server copied to clipboard

ErrRejectPacket should be returned in PubAck per v5 spec

Open SimonMacIntyre opened this issue 9 months ago • 3 comments

https://github.com/mochi-mqtt/server/blob/8f52b891d5d3169340cbfd29cec6a6408ed66f31/server.go#L911-L912

The above behaviour is wrong for v5 spec. Currently if this packet code is assigned to a packet from OnPublish on some custom logic based failure, the expected and desired behaviour is for the ErrRejectPacket to be the reason code used in the PubAck. You can see this in v5 spec here.

Image

Mochi ref to the code: https://github.com/mochi-mqtt/server/blob/8f52b891d5d3169340cbfd29cec6a6408ed66f31/packets/codes.go#L95-L95

SimonMacIntyre avatar Mar 24 '25 15:03 SimonMacIntyre

If maintainers can confirm/agree, I don't mind tackling the PR 🙏

SimonMacIntyre avatar Mar 24 '25 18:03 SimonMacIntyre

Thanks @SimonMacIntyre , this makes sense. Please submit a PR.

thedevop avatar Mar 25 '25 06:03 thedevop

I haven't forgotten, it's in my todo list :D

If it's urgent to anyone else which seems unlikely, feel free but I should get to this in the next week or two!

SimonMacIntyre avatar Apr 04 '25 14:04 SimonMacIntyre