nmqtt icon indicating copy to clipboard operation
nmqtt copied to clipboard

Added support for shared subscriptions

Open pires22 opened this issue 1 year ago • 4 comments

pires22 avatar Feb 27 '23 01:02 pires22

Interesting, thanks! I haven't used shared subscriptions myself. I can see that it's only available in the specification for x >= MQTT v5.0.

Would you be up for adding a simple test case in the tests/ directory?

I don't have time right now to do the testing, maybe @lmn or @lpapier would be up for it?


Direct link to MQTT v5.0 specification

3.2.2.3.13 Shared Subscription Available 42 (0x2A) Byte, Identifier of Shared Subscription Available.

Followed by a Byte field. If present, this byte declares whether the Server supports Shared Subscriptions. A value is 0 means that Shared Subscriptions are not supported. A value of 1 means Shared Subscriptions are supported. If not present, then Shared Subscriptions are supported. It is a Protocol Error to include the Shared Subscription Available more than once or to send a value other than 0 or 1.

If the Server receives a SUBSCRIBE packet containing Shared Subscriptions and it does not support Shared Subscriptions, this is a Protocol Error. The Server uses DISCONNECT with Reason Code 0x9E (Shared Subscriptions not supported) as described in section 4.13.

ThomasTJdev avatar Feb 27 '23 08:02 ThomasTJdev

Sure, I will work on it!

Shared subscriptions are available on mqtt 5.0 brokers, but the clients don't need to be using mqtt 5.0

I only added support for it in the client part as you can see in the commit, I hope thats fine.

pires22 avatar Feb 27 '23 15:02 pires22

Sure, I will work on it!

Shared subscriptions are available on mqtt 5.0 brokers, but the clients don't need to be using mqtt 5.0

I only added support for it in the client part as you can see in the commit, I hope thats fine.

Just a simple test case - both for testing in the future, and as a tutorial for users. That would be great!

Yes, that is absolutely fine - they are not interconnected in that regards. The repo is a little mixed in the current state as a binary-package and a library-package, and they should maybe have been splitted into two different repos...

ThomasTJdev avatar Feb 28 '23 06:02 ThomasTJdev

Hi @pires22 - Up for adding a test case?

ThomasTJdev avatar Feb 10 '24 07:02 ThomasTJdev