Thank you for your books quality. I would like to know whether you have a project where:
- we can remotely (through the internet) trigger outputs of an ESP8266 by a smart phone for example,
- and receive informations on the ESP8266 GPIO state in the same smart phone used to trigger outputs
- So the link between ESP8266 and smart phone is bi-directional, we can trigger outputs and receive GPIO status.
Thank you so much.
When you say that you want the link to be bi-directional, are you referring to web socket protocol?
You can check the “Build Web Servers” eBook – it includes several examples of how to control GPIOs and update the state on the web page (using web sockets and other methods).
Hello, WebSocket is OK BUT I CANNOT CONTROL THROUGH THE INTERNET OVER A LONG DISTANCE. I need a design that allows me to control a GPIO output of ESP8266 that is situated in another city for example by using the internet and at the same time having feedback. Exactly like WebSocket but with larger applications by using the internet.
That is true. You would need to open your router as well as the router the ESP8266 is connected to which is not something most people want.
This is why I suggested MQTT. It’s a secure protocol to connect to a central broker (HiveMQ has an open source broker). Could you tell me why you don’t want to use MQTT?
I do believe I forgot to mention that some cloud brokers provide web socket connections including CloudMQTT.
I have absolutely no problem using MQTT. Can you please send me specific projects names using MQTT with HIveMQ so that I can test them and use them ?
I’m afraid I don’t have anything for you. Check the HiveMQ community forum.
Random Nerd Cloud MQTT tutorial recommends Digital Ocean which gives you a $100 credit to use for 60 days which you can cancel at any time. That tutorial has all the code you need to begin testing. The good thing about Digital Ocean is that you get a VM that can run Ubuntu (and maybe even Docker) which you can install a MQTT Broker as well as anything else you may want like a web server. Everything appears to be $5/month to start so dedicated brokers appear pretty expensive compared to Digital Ocean.
I have been doing more research and you may want to try ngrok. Whilst MQTT is way cool and more extensible, if all you need is to connect via web sockets to one device then ngrok is one way to do it.
The “Extra” section on the eBook contains a chapter explaining how to do that using Ngrok. See page 583.
If you want to use Ngrok with a web server that uses WebSocket protocol, I recommend reading this discussion first: https://rntlab.com/question/rgrok-and-esp8266-webserver/
Basically, you need to use HTTP instead of HTTPS for the WebSocket protocol. Everything is explained on that thread.
I hope this helps.