Closed wic006 closed 3 months ago
Thanks - I'm not hugely happy with this, but think it's probably the best way forward. Returning a nil
pointer when there is no error is more likely to cause a runtime crash than returning a value (and the default value will have a status of 0
- PubackSuccess
so seems reasonable). If you get a chance it would be good to have a comment that explains this (just because it's somewhat unexpected that there would be a response to a QOS0 message)..
Thanks - I'm not hugely happy with this, but think it's probably the best way forward. Returning a
nil
pointer when there is no error is more likely to cause a runtime crash than returning a value (and the default value will have a status of0
-PubackSuccess
so seems reasonable). If you get a chance it would be good to have a comment that explains this (just because it's somewhat unexpected that there would be a response to a QOS0 message)..
Thanks for the feedback- put up a PR to add that information as a comment. I figured it may be useful to clarify that the PublishResponse return value is typically only useful for QOS1+.
PublishWithOptions may return both nil error and nil PublishResponse when QoS0 is used, which can potentially result in nil pointer exceptions. This commit updates PublishWithOptions to return a pointer to an empty PublishResponse when QoS0 is used to eliminate this risk.
Closes #159