Trigger output when client connects to esp32 wifi

hi all, this is my first post so you will proberbly tell im new to all this. i hope i am allowed to post this also

i currently have a esp32 and a esp8266. currently i am playing with the esp32. I have arduino software all connected, i have played with the example projects and dont the usual lights etc. all projects i have tried so far work great :) the main reason of what i am trying to do is the following:

get the esp32 to broadcast a wifi network (or bluetooth) and when someone successfully connects it triggers a gpio pin for a few seconds and then turns it off. thats kind of it lol.

any help where to look or a example code of achieving this would be awesome. appreciate your time reading !

Tom

Here is a link to the ESP32 API reference https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/index.html.

The BLE or WiFi API might provide you with info.