shamblett / mqtt5_client

A server and browser based MQTT 5 client for dart
Other
49 stars 25 forks source link

what is the difference between mqtt_client and this one? #67

Closed OpenJarvisAI closed 6 months ago

OpenJarvisAI commented 9 months ago

previosu maintained no longer?

shamblett commented 9 months ago

The mqtt_clent is for MQTT 3.1, this one is for MQTT 5 although the API of the two packages is basically the same.

If you do not need MQTT 5 features you are better of using mqtt_clent.

jakelevirne commented 9 months ago

If I’m building an app that users can use to connect to either an mqtt 5 or 3 broker, can I just use this library or do I need to import both?

shamblett commented 9 months ago

If your users need basic MQTT functionality as provided by MQTT 3 and also the extended functionality as provided by MQTT 5 then use this library. All modern brokers support both MQTT 3 and MQTT 5 so you should be OK here. This client only identifies itself as an MQTT 5 client so this won't work with older non MQTT 5 brokers as they are expecting an MQTT 3 client however these are fairly rare these days. If you are using one of these brokers then you will have to use the mqtt_client.

OpenJarvisAI commented 9 months ago

@shamblett My server brokers supports mqtt5, can I upgrade this lib in my client from your previous to mqtt5? Does the code need to change?

thanks, btw, what advantages could mqtt5 brings ?

shamblett commented 9 months ago

Yes, it should be a drop in change i.e. change your import from mqtt_client to mqtt5_client.

Mqtt 5 adds message properties, definable authentication schemes, better status code feedback from the broker and topic aliases amongst other bits am bobs.

OpenJarvisAI commented 9 months ago

From my understanding, mqtt5_client could be the long term support now? If so, I will move to mqtt5_client now. Hopefully can resolve one of my disconnecting imediately issue when connected