davidepianca98/KMQTT

Connecting to a home broker with TCP_PORT & MQTT_PORT

y9Kap opened this issue · 4 comments

Hello. I wrote my home broker with access to the external Internet and cannot connect to it, since the path to it looks like this: tcp://ХХ.ХХ.Х.ХХХ:TCP_PORT:MQTT_PORT. That is, I have a separate port for TCP and for MQTT. How can I connect to my broker using your library?

Hello, this seems very weird, I don't think it is possible in general to have this setup. The MQTT port in reality doesn't exist, it is the port of the underlying TCP server that then handles MQTT packets. I think you may be talking about port forwarding with a different port, please let me know if this is the case.

IMG_20240105_142042
Screenshot_2024-01-04-08-36-00-15
This is how I connect through the app МQTT Client. I allocated a port 8884 on the router for my microcontroller

Can you please try removing ":8884" from the URL field and set the Port field to 8884 instead of 1883? The router should automatically redirect from port 8884 to the port of the broker depending on how you configured it, I guess 8884 mapped to 1883. So when connecting from the outside world you should only need to specify port 8884.

Can you please try removing ":8884" from the URL field and set the Port field to 8884 instead of 1883? The router should automatically redirect from port 8884 to the port of the broker depending on how you configured it, I guess 8884 mapped to 1883. So when connecting from the outside world you should only need to specify port 8884.

Despite your quick response, thank you for this, I figured out how to bring my broker to the external Internet in a different way: send it to DMZ in WIFI-Router. Now I don't need to specify an additional port. I also isolated my microcontroller from other devices on the network to maintain security.