I use MQTT (Mosquitto) and several ESP8266 for sensoring issues.

I want that the clients also can "subsribe" to trigger actions on the clients.

The MQTT Server is placed in a VLAN of my main router. Beside this VLAN another router (let's call it ESP Router) is connected to the main router (all intralan).

The WiFi clients from the ESP router cann connect to the MQTT server via 1883.

But if I want to subscribe topics on the WiFi clients I need port forwarding on the ESP Router. I just can port forward a specific port to a specific port/address. How can I portforward to this complete WiFi subnet? I am using Mikrotik routers.

  • 1
    If you are looking for help in how to configure a specific router then the question is off topic for IoT and should be asked on Super User (with a LOT more detail e.g. a diagram of your network layout) – hardillb May 23 '19 at 7:46

If the clients can connect to the broker then you shouldn't need anything else.

MQTT works over TCP, it's a single persistent bidirectional connection.

The flow is:

  • client connects
  • client subscribed
  • when matching message arrives, broker sends message over existing connection to client
  • if no messages arrive in keep alive period, broker pings client, client responds

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