Hi,
On 10-Aug-12 4:48, Timo Sirainen wrote:
Related question that came to my mind: Does anyone know if XAPPLEPUSHSERVICE feature can be implemented by any server, or does it require cooperation between the server and the mobile network operator? I'm guessing the latter..
the Apple push service for Mail.app uses the same push notification service as all other push notifications for iOS (APNS, Apple Push Notification Service). The Device retains a persistent connection to Apple's APNS Gateway.
To transmit a push notification via APNS, the sender needs a certificate issued by Apple for the receiving application (Mail.app in this case). One can get such a certificate by purchasing Lion Server, which includes such a certificate (I presume Mountain Lion Server does as well).
The Lion Server uses dovecot, and Apple's patch for the XAPPLEPUSHSERVICE extension is available on http://www.opensource.apple.com/source/dovecot/dovecot-239/dovecot/src/plugi...
It basically works as following:
- Dovecot advertises the XAPPLEPUSHSERVICE Capability
- When the device logs in to the IMAP server and sees that it supports this capability, it registers with the server for push notifications and provides its device id and the id of the corresponding mail account on the device. These two ids are required to route a push notification to the device.
- The server records all registered devices for an account. Upon an incoming mail for the account, it transmits a push notification.
- The device does not directly unregister; this is done using the feedback mechanism of APNS, which tells a service provider that a device does not wish to receive push notifications any longer.
The actual transmission of the push notifications to the APNS server is not part of the dovecot patch but a separate program. One can use the Net::APNS perl module (found on cpan) to fairly easily replicate that program. Apple's original is also available:
http://www.opensource.apple.com/source/dovecot/dovecot-239/dovecot.push-noti...
-Mike
P.S.: I'm not sure if one is allowed to do this, though.