,

Sending Push Notifications

Sending a toast or tile push notification is done by creating an XML envelope containing the notification information, converting it to a byte array, and then sending it via an HttpWebRequest to the MPNS.


Note

When sending a push notification, only the HTTP POST method is allowed. Using any other method such as GET, PUT, CREATE, or DELETE results in a 405 MethodNotAllowed response. Moreover, a ProtocolViolationException results when writing to the request Stream.

For testing purposes, however, the HTTP GET method can be used, and results in a 200 OK response regardless.

An example of a push notification URL is http://sn1.notify.live.net/throttledthirdparty/01.00/AAGvdLTQzLGqRZ0FRZRVT1GBAgoOs1kPAQAAAAQOMDAwAAAAAAAAAAAAAAA.

The notification URL subscriber identifier, which is located after the final forward slash, does not need to resolve to an active subscription. This prevents a third party from fishing for an active subscription URL.


Raw notifications have more flexibility in their format; however, the process of sending a raw notification remains the same as that of tile and toast notifications. The following sections explore in detail how to send toast, tile, and raw notifications.


Caution

When sending a notification, the maximum size of a toast, tile, or raw notification body should not exceed 1KB. If this size is exceeded, a System.Net.WebException is raised, resulting from a 400 (Bad Request) response code returned from the MPNS.


For a complete list of MPNS response codes, see http://bit.ly/wd6SXy.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.21.229