I have a NodeMCU and a website (free website domain provided by http://www.hpage.com) and I have to send and receive some data (suppose a 8bit number) from the website to the NodeMCU via internet. The NodeMCU is connected to internet through WiFi hotspot of an Android phone.

  • Can anyone provide an example code? How can I address the NodeMCU from the website?
  • Does the NodeMCU need to be a server or just a client?

Thanks in advance for kind help.

closed as too broad by MichaelT, sempaiscuba, VE7JRO, MatsK, gre_gor Feb 15 at 5:50

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.


How can I address the NodeMCU from the website?

You can't. The NodeMcu is behind the phone, behind a router, behind a gateway of the operator etc. It can access the Internet over the infrastructure routing it out, but is not visible from the Internet.

Does the NodeMCU need to be a server or just a client?

The device should be a client and open the communication to the server by sending a request and renewing the connection if it times out. You can use WebSockets or MQTT or similar framework.

  • Well, I have seen people address devices connected to router by the name of service port. Isn't it possible for Android? Some apps use this service port address to share data over wifi. Anyway, thanks for mentioning. I'll try MQTT. – Shounak Feb 12 at 2:52
  • to setup port forwarding you must have a public IP address and control over router/gateaway. other option is to use a VPN set on a server in Internet – Juraj Feb 12 at 6:42
  • @Shounak, did the answer help? – Juraj Mar 21 at 13:51

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