0

I have mqtt broker by ip

mqtt://xxx.xxx.xxx.xxx:8888/

I have a web site

http://mywebsite.com/

Now, I want to make like this

mqtt://mywebsite.com:8888/

If it would be like this still can:

mqtt://iot.publicwebsite.com:8888/ FORWARDFROM-> http://localhost:8888/
OR
mqtt://iot.publicwebsite.com:8888/ FORWARDFROM-> http://xxx.xxx.xxx.xxx:8888/
Mystogan
  • 114
  • 2
  • 13
  • Do you mean native MQTT or MQTT over websockets? – hardillb Mar 27 '19 at 07:29
  • Thank you for replying sir, I'm currently set up own IOT/MQTT website. Like iot.eclipse or iot.ubidots for example. So, which way I should go through ?. I already have mqtt in my local network and can access everywhere by my local network. I want it can access to the public. – Mystogan Mar 27 '19 at 07:42
  • You should know how you have configured your broker – hardillb Mar 27 '19 at 07:47
  • I found this but some comments has been deleted I see. I can't find my way for my solution. https://iot.stackexchange.com/questions/2021/mqtt-broker-accessible-from-outside-without-opening-port-in-firewall – Mystogan Mar 27 '19 at 07:55

1 Answers1

2

Depending on if you are using Native MQTT or MQTT over Websockers you have 2 choices

  1. Set up port forwarding on your public facing machine. This means configuring the firewall to take any traffic that arrives on port 8888 and forwarding it to the broker machine and doing the reverse with any response traffic. Assuming you are on Windows then you would use the netsh command. See this question for details. This should work for both Native MQTT and MQTT over Websockets. If you are already using port forwarding from your router to the machine running ISS then you need to set up the port forwarding to the broker in the router, not the Windows machine.

  2. If you are using MQTT over Websockets then you can configure ISS to act as a reverse proxy. This question explains how to do that.

hardillb
  • 54,545
  • 11
  • 67
  • 105
  • For no 1, If it is related/working if it's in same/local network. It's not working if there's no LAN. For no 2 , it uses (localhost) meaning by that it's internal network. For make it clear I have a hardware connected to internet by wifi and it's far far away. There's no internal network with my iot/mqtt server/broker. I want my hardware can send data to live mqtt or ws protocol. By that I need to make my internal thing open up to the public. So, everyone can access it from far. iot.ubidots.com for example. It's a way like vpn thing for hardware access internal/local network from far, not LAN – Mystogan Mar 27 '19 at 09:23
  • I'm sorry, but I really do not understand any of that – hardillb Mar 27 '19 at 09:25
  • well, it's not m2m thing anymore. It's about a mqtt web and I really disappointed myself in this course. I can't do it. Stuck on a web thing – Mystogan Mar 27 '19 at 09:32
  • Thank you so much @hardillb for solving my problem :) – Mystogan Mar 27 '19 at 14:50