shamblett / mqtt_client

A server and browser based MQTT client for dart
Other
552 stars 179 forks source link

Using Mount Point option in authentication #254

Closed exdevop closed 3 years ago

exdevop commented 3 years ago

I have mountpoint as one of my users' authentication info, and I am not able to find where to pass it, though I believe it should passed along with clientID . Kindly advice.

I am using VerneMQ latest version; 1.11.0 on Ubuntu 18.04.

shamblett commented 3 years ago

From the VerneMQ broker docs -

Normally, an MQTT broker hosts one single topic tree. This means that all topics are accessible to all publishers and subscribers (limited by the ACLs you configured, of course). Mountpoints are a way to host multiple topic trees in a single broker. They are completely separated and clients with different topic trees cannot publish messages to each other. This could be useful if you provide MQTT services to multiple separated use cases/verticals or clients, with a single broker. Note that mountpoints are configured via different listeners. As a consequence, the MQTT clients will have to connect to a specific port to connect to a specific topic space (mountpoint).

so it seems you need to connect the client to a different port to get different mountpoints, you can specify the port using the .withPort constructor.

If you need to use the client identifier then you can do, the client identifier is whatever you want it to be, you will need to see you broker docs on how to do this. Don't worry about any warnings in the log about client id length, this is just telling you that technically ots a spec violation but all brokers I know of ignore this.

exdevop commented 3 years ago

Noted, I saw the option being passed when creating the user with plugins.vmq_diversity = on turned on an mysql authentication is used. Anyway am beginning to think that I can test it without passing it as an authentication option and just including it in the user creation stage, also setting it in listener level since am also noticing no mqtt client apps that have it in connection configs. Thank you.