Deep sleep sensor

Hi,

I’m new to Mozilla WebThings. I’m trying to understand how the gateway and things interact with each other. If I create a thing using esp8266 and following the examples from webthings-arduino, it’s the thing that has a server running on it and gateway acts as a client and connects to the server running on the thing to get data. Do I understand correct?

If I do, how would gateway know that a thing just wakes up from deep sleep? Does gateway poll the thing to see if it’s alive periodically?

I want to keep energy usage as low as possible on ESP8266. So I want the thing could immediately send data to gateway when it wakes up and goes to sleep immediately after that. If gateway uses polling, this will not be successful. Maybe I need an adapter running on gateway and listening for thing to connect. Is there such an adapter already?

Thanks,
Jie