ESP8266 in AP Mode -determining if a station is connected
Followup answer from comments: 

The issue was an outdated version of the ESP8266-Arduino framework. The function WiFi.softAPgetStationNum() is available in 2.4.1

For the sake of completeness: The function itself is simply a wrapper for the Espressif non-os SDK function:

/**
 * Get the count of the Station / client that are connected to the softAP interface
 * @return Stations count
 */
uint8_t ESP8266WiFiAPClass::softAPgetStationNum() {
    return wifi_softap_get_station_num();
}


See Espressif Non-OS SDK API reference chapter 3.5.36.

That function should also be available on older framework versions. However, upgrading is the recommended way to use that function.