1

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.

0

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.

|improve this answer|||||
  • 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 '19 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 '19 at 6:42
  • @Shounak, did the answer help? – Juraj Mar 21 '19 at 13:51

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