It depends on you having control over the software from the esp32's.
Since you mentioned broadcasting, I assume the protocol to be UDP, but you can also do that differently as long as it is socket based. But indeed, basically you only need a listener.
Take the echo example from stack overflow as an example: instead of echo, you log the identity from the ESP32's and its messages. That takes very few changes to the code.