How do push notifications work from a networking point of view? I know the data antennas (3G, WiFi, etc.) power down to save battery, but push notifications still seem to come almost immediately. My iPhone and iPad will chime before the email shows up on my desktop. I'd hooked up a TCP/IP sniffer on my Wifi iPad and noticed the push notifications didn't come via TCP/IP. I understand the sending and receiving of push notifications from the App point of view (register the device, send notification to Apple, who sends it to the device), but would like to know more about this last leg of the trip. I see that Apple says port 5223 is involved somehow, but much in the way of details.

I've searched around the web some and not found anything that explains the mechanism of delivering push notifications from Apple to an iOS device. Is it UDP? Is it an existing always on connection? Why doesn't it kill the battery? Basically, how can the notification happen almost immediately without keeping the radio always on, thus killing the battery?
WiFi networks use "beacons" to allow clients to enter power-saving mode, but still be notified regularly if there is any traffic waiting to be sent to them.

Before entering power-saving mode, a WiFi device checks how often beacons are sent from the AP (typically, every 100ms, so ten per second, but some APs will let you vary it) and then wakes up in time to receive it. This beacon tells the client if there is any traffic waiting to be sent to it. Thus, it can still spend most of it's time powered down, but occasionally wake up to see if there's any real work to do. If there isn't, it immediately goes back to sleep again. And therein lies the powersavng.

Good page on it here: http://www.wi-fiplanet.com/tutorials/article.php/1492071/