1

My Mosquitto server whole ACL file content:

pattern write s1/%c
pattern read s1/%c

I know there should be possibility to have single line:

pattern readwrite s1/%c

But my server complains with error:

Empty invalid topic access type in acl_file.

I suppose two lines should make the same like single readwrite one. Please, correct me if I'm wrong.

I do subscribe to s1/ss from client ss:

mosquitto_sub -h 192.168.1.8 -t s1/ss --cafile ca.crt -p 8883 -d -u b -P b -i ss

And I do publish from client ss:

mosquitto_pub -h 192.168.1.8 -t s1/ss --cafile ca.crt -m "test" -p 8883 -d -u b -P b -i ss

According to Mosquitto log server informs it is happy with publish, but subscriber not receives message. Even worse, according to log at the same time it resubscribes to server.

1577902083: New connection from 192.168.1.222 on port 8883.
1577902083: Client ss already connected, closing old connection.
1577902083: New client connected from 192.168.1.222 as ss (c1, k60, ub).
1577902083: Sending CONNACK to ss (0)
1577902083: Received PUBLISH from ss (d0, q0, r0, m0, 's1/ss', ... (4 bytes))
1577902083: Received DISCONNECT from ss
1577902084: New connection from 192.168.1.222 on port 8883.
1577902084: New client connected from 192.168.1.222 as ss (c1, k60, ub).
1577902084: Sending CONNACK to ss (0)
1577902084: Received SUBSCRIBE from ss
1577902084:     s1/ss (QoS 0)
1577902084: ss 0 s1/ss
1577902084: Sending SUBACK to ss

Why my subscriber not receives message? Does my ACL lines are correct?

1 Answer 1

4

You can't have 2 clients connected at the same time with the same client id.

You have hardcoded the same client id -i ss for both the publisher and the subscriber.

Since you are starting the subscriber first, it will be kicked off the broker as soon as the publisher connects, hence it will not be connected when the publisher actually publishes the message, so will not see it.

This has nothing to do with the ACL

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.