I am trying to establish communication between two Arduino boards to send data from sensors through a WIFI module. The problem is that I need them to connect to each other whenever they are in range of each other and send the sensor data.
The esp8266 WiFiMulti system allows to configure more access points and with the rigth code in loop it always searches the best AP.
Configure one of the esp8266 as AP and setup the other with WiFi Multi only for this one access point.
You can then use events like
onStationModeConnected to handle data exchange if the connection is established.