Various ESP32 connected to each other throught internet?

Hi there,

I'm planning to do a project for next christmas. It will consist in, basically, a lamp. The point is that the lamp will be controlled by an ESP32 and a hidden PIR sensor. They'll be seven of them. I'm going to give one to each friend of mine (The lamp is photo of us together). The funny fact is that whenever any lamp is triggered by the hidden PIR sensor (Which actually means that one of the pals remembers the rest just waving the hand behind the lamp, for example) the rest of lamps will be triggered as well for a certain time.

I'm also planning on add more functions, but that was the basic point. The first problem is that my friends don't know how to configure networks, much less about programming. I'll develop a tiny app with they will pass their WiFi parameters to theirs respectives lamps throught bluetooth. Not a big deal.

I'm thinking on something that just connects to a... server? Where every lamp reports it's PIR state, and then the server will answer the request with the PIR state of the other six lamps. I've done similar things on my own, but in my local network, involving configuration on the router. What I need is something that connects automatically to a server which I'll probably suit up on my home. Maybe my own lamp could act as a server for the others. That way I could leave the adress of my lamp-server pre-programmed and my friends won't have to do anything but connect their lamps to the internet, without portforwarding or anything of that kind. Here's when I've read a bit of tinyUPnP and easyDDNS libraries for ESP32... But I don't know if there's another way to achieve this. Maybe a more proper way... I'm actually asking for a "brain stormy"

What do you think? tinyUPnP and easyDDNS will do the job? Is there anything better? Since I don't really know how to call this sort of connection, It's very difficult for me to found information... I need a guideline to follow, just beacuse this is my first "complex" IoT project.

Thanks in advance, cheers!

Have a look at MQTT. Its is a lightweight publish-subscribe protocol on top of TCP/IP. It is supported by Arduino, ESP32, on Raspberry Pi, PC/MAC and cloud services. You can find examples for all kind of programming languages and environments e.g. C, python, node-red Javascript ... There are tools to help you during development like Eclipse Paho MQTT Utility that allows you to receive and publish messages using a graphical interface.

https://en.wikipedia.org/wiki/MQTT

https://mqtt.org/software/