In this example, the App requests data from the ESP8266 and it sends it to it, maybe you can get some idea.