How to open port for receiving a mqtt message with iptables

I have a question. I installed paho-mqtt on autopi.
I can publish to a topic but can not subscribe to the topic.
I use 19418 port for mqtt communication.
In case of not subscribe, should I add a rule in iptables? or should I change any other files?

not sure if these are sufficient

sudo iptables -A INPUT -p tcp --dport 19418 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
sudo iptables -A OUTPUT -p tcp --sport 19418 -m conntrack --ctstate ESTABLISHED -j ACCEPT

Thank you for your suggestion!
I tried to add new rules that you gave me but it didn’t work.
It’s still hard to find what is blocking the mqtt message for me.
Please let me know if there is something I need to try to solve the issue.

Thank you again for your help!

This topic was automatically closed 33 days after the last reply. New replies are no longer allowed.