Hello,
I have to expose my esp32 to the public. The esp would post its local IP to a database on a webserver from where it then can be found. I am not able to set up the router because it has to work on public networks and without any third-party service such as ngrok. I have a webserver available and I want to make both HTTP requests and WebSocket connections.
Unfortunately, I was not able to find how to set this up in such a way.
Could somebody be so kind as to point me in the right direction?
expose ESP32 WebServer to public without router setup or third party service
Re: expose ESP32 WebServer to public without router setup or third party service
Never say never but not possible without router access and/or you have the uplink.
How is an external client going to address you when all you have is a 'local' class C address?
You need port forwarding or a 'less local' IP address (direct, remove the router) to be found.
Now maybe you could do something with a remote host. You register with the host and the host acts as you're proxy.
You would have to poll the 'host' however (because the host cannot reach you).
Turn it around, host the website on a public server & post your data...
Sounds like a job for AWS man!
How is an external client going to address you when all you have is a 'local' class C address?
You need port forwarding or a 'less local' IP address (direct, remove the router) to be found.
Now maybe you could do something with a remote host. You register with the host and the host acts as you're proxy.
You would have to poll the 'host' however (because the host cannot reach you).
Turn it around, host the website on a public server & post your data...
Sounds like a job for AWS man!
& I also believe that IDF CAN should be fixed.
Re: expose ESP32 WebServer to public without router setup or third party service
Dyndns
IT Professional, Maker
Santiago, Dominican Republic
Santiago, Dominican Republic
Re: expose ESP32 WebServer to public without router setup or third party service
Thanks for your answer. The esp32 should be capable of getting the publicIP of the router isn't it? now it would just have to tell the router to forward posts that are coming onto the public IP on a specific port to the esp IP. Why is that not possible?PeterR wrote: ↑Tue Jun 30, 2020 12:51 amNever say never but not possible without router access and/or you have the uplink.
How is an external client going to address you when all you have is a 'local' class C address?
You need port forwarding or a 'less local' IP address (direct, remove the router) to be found.
Now maybe you could do something with a remote host. You register with the host and the host acts as you're proxy.
You would have to poll the 'host' however (because the host cannot reach you).
Turn it around, host the website on a public server & post your data...
Sounds like a job for AWS man!
Could I use MQTT and Azure for this? With the esp32 as a publisher of readings and at the same time a subscriber to configuration changes of the Azure database?
Also would it be possible to establish a P2P connection with somebody accessing the website on the public server? maybe using peerJS?
It's critical to get real time life readings. I know MQTT is quite fast but P2P would be even better.
I want to host my own DDNS with my database. The question is how do I actually access the ESP32 with that information?
Re: expose ESP32 WebServer to public without router setup or third party service
Typically yes, if you know the router's API. Most routers have a page displaying public IP and some provide that data in an easy to use API.The esp32 should be capable of getting the publicIP of the router isn't it?
It is possible. It is how the router works & why you can watch Netflix whilst junior plays CoD.now it would just have to tell the router to forward posts that are coming onto the public IP on a specific port to the esp IP. Why is that not possible?
Your question was:
This is not possible.The esp would post its local IP to a database on a webserver from where it then can be found.
The internet works using a set of routable codes & masks. Your local address e.g. 192.168.80.2 is similar to saying your home address is 'number 15', which street? which town etc.
The way the router works is by forwarding your requsts using its own public IP (because if I sent my Amazon order out with my address as 'number 15' its not going to work well) but using a specific port and remembering the translation between port used and local IP address. On return of data (to the public router address) the router is then able to work out who the request is for and forwards to the local address.
The crux point is that the local address is always requesting. Ok there are public 'send to everypone' protocols but we will ignore multicast for the moment.
Absolutely, or any other cloud system.Could I use MQTT and Azure for this? With the esp32 as a publisher of readings and at the same time a subscriber to configuration changes of the Azure database?
You are not going to get 'real time' in 'real time'. You can get measurements at precise intervals but in arrears, like video buffering. P2P support depends on the server.Also would it be possible to establish a P2P connection with somebody accessing the website on the public server? maybe using peerJS?
It's critical to get real time life readings. I know MQTT is quite fast but P2P would be even better.
You will find MQTT easier to get running and more widely supported.
& I also believe that IDF CAN should be fixed.
Re: expose ESP32 WebServer to public without router setup or third party service
PeterR wrote:Typically yes, if you know the router's API. Most routers have a page displaying public IP and some provide that data in an easy to use API.The esp32 should be capable of getting the publicIP of the router isn't it?It is possible. It is how the router works & why you can watch Netflix whilst junior plays CoD.now it would just have to tell the router to forward posts that are coming onto the public IP on a specific port to the esp IP. Why is that not possible?
Is it possible to do this without setting up the router from a third party device?
thanks that clarified a lotYour question was:This is not possible.The esp would post its local IP to a database on a webserver from where it then can be found.
The internet works using a set of routable codes & masks. Your local address e.g. 192.168.80.2 is similar to saying your home address is 'number 15', which street? which town etc.
The way the router works is by forwarding your requsts using its own public IP (because if I sent my Amazon order out with my address as 'number 15' its not going to work well) but using a specific port and remembering the translation between port used and local IP address. On return of data (to the public router address) the router is then able to work out who the request is for and forwards to the local address.
The crux point is that the local address is always requesting. Ok there are public 'send to everypone' protocols but we will ignore multicast for the moment.
ok looks like MQTT is the way to go then... Thanks!Absolutely, or any other cloud system.Could I use MQTT and Azure for this? With the esp32 as a publisher of readings and at the same time a subscriber to configuration changes of the Azure database?You are not going to get 'real time' in 'real time'. You can get measurements at precise intervals but in arrears, like video buffering. P2P support depends on the server.Also would it be possible to establish a P2P connection with somebody accessing the website on the public server? maybe using peerJS?
It's critical to get real time life readings. I know MQTT is quite fast but P2P would be even better.
You will find MQTT easier to get running and more widely supported.
Re: expose ESP32 WebServer to public without router setup or third party service
You would have to run this software from a server and have your local device register with the server. End users would do the same. The server address would be the public point of access because you cannot change your router (EDIT) & no one can see you hidden behind your router (in fact many routers will try their best to hide you from worms etc).*Is it possible to do this without setting up the router from a third party device?
EDIT: Because you say that you cannot configure you're router
A server based MQTT broker allows you to register on a topic and publish etc. Your router is still doing the port/local address translation this time with a websocket. Other tech is possible.
Reliable transmission/reception requires a connection based socket. Your device does not have a public address & so others (EDIT) cannot make a connection to you. You can make a connection with someone outside your environment - your router will translate & essentially extend your address for you. The server acts as the man in the middle hence the 'Broker' name.
EDIT: Outside your local network
* Be careful. In some corporate environment most ports will be shut down so even MQTT might not work.
& I also believe that IDF CAN should be fixed.
Who is online
Users browsing this forum: Majestic-12 [Bot] and 120 guests