Leveraging azure and cello for delivering highly scalable multi tenant
Delivering Notifications With Windows Azure
description
Transcript of Delivering Notifications With Windows Azure
![Page 1: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/1.jpg)
![Page 2: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/2.jpg)
Agenda
Review of Live TilesA deeper look at using the Windows Push Notification ServiceIntroduction to the Windows Azure Toolkit for Windows 8You’ll leave with examples of how toEnable push notifications for your serviceBuild a push enabled service using Windows Azure
![Page 3: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/3.jpg)
demo
![Page 4: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/4.jpg)
Live Tiles with Push Notifications
![Page 5: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/5.jpg)
![Page 6: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/6.jpg)
Windows Push Notification Service (WNS)
![Page 7: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/7.jpg)
Push Notification Overview1. Request Channel URI2. Register with your
Cloud Service3. Authenticate &
Push Notification
Windows 8
(1)
(2)
(3)
(3)
![Page 8: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/8.jpg)
1. Request a Channel URIEach tile has a unique Channel URIRequested by App on each run. URI can changeGenerated by WNSOpaque to the app
Windows 8
(1)
(2)
(3)
(3)
![Page 9: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/9.jpg)
var push = Windows.Networking.PushNotifications;var promise = push.PushNotificationChannelManager
.createPushNotificationChannelForApplicationAsync();
promise.then(function (ch) {var uri = ch.uri;var expiry = ch.expirationTime;updateChannelUri(uri, expiry);
});
https://db3.notify.windows.com/?
![Page 10: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/10.jpg)
2. Register with Your Cloud Service Register your app with
your own Cloud ServiceShould be authenticated and secure
Store Channel URI and associate it with any app specific contextCreate your business logic for sending notifications
Windows 8
(1)
(2)
![Page 11: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/11.jpg)
function updateChannelUri(channel, channelExpiration) {if (channel) {var serverUrl = "https://mysampleapp.cloudapp.net/register";var payload = { Expiry: channelExpiration.toString(),
URI: channel };var xhr = new WinJS.xhr({
type: "POST",url: serverUrl,headers: { "Content-Type": "application/json; charset=utf-8" },data: JSON.stringify(payload)}).then(function (req) { … });
}}
![Page 12: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/12.jpg)
3. Authenticate & Send Notification
OAuth 2 AuthenticationHTTP POST to Channel URIXML notification payload
Windows 8
(2)
(3)
(3)
![Page 13: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/13.jpg)
3. Register Your App
![Page 14: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/14.jpg)
POST https://login.live.com/accesstoken.srf HTTP/1.1Content-Type: application/x-www-form-urlencodedHost: login.live.comContent-Length: 221
grant_type=client_credentials&client_id=ms-app%3A%2F%2FS-1-15-2-1633617344-1232597856-4562071667-7893084900-2692585271-282905334-531217761&client_secret=XEvTg3USjIpvdWLBFcv44sJHRKcid43QXWfNx3YiJ4g&scope=notify.windows.com
![Page 15: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/15.jpg)
HTTP/1.1 200 OKCache-Control: no-storeContent-Length: 422Content-Type: application/jsonConnection: close{
"access_token":"EgAcAQMAAAAg/RBw++jdA1MzM0LTUzMTIxNzc2MQA=", "token_type":"bearer“
}
![Page 16: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/16.jpg)
3. Push Notification HTTP RequestPOST https://db3.notify.windows.com/?token=AQI8iP%2OtQE%3d HTTP/1.1Content-Type: text/xmlHost: db3.notify.windows.comX-WNS-Type: wns/badgeAuthorization: Bearer EgAcAQMAAAAg/RBw++jdA1MzM0LTUzMTIxNzc2MQA=Content-Length: 58
<?xml version="1.0" encoding="utf-8"?><badge value="34"/>
![Page 17: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/17.jpg)
3. Push Notification HTTP ResponseHTTP/1.1 200 OKContent-Length: 0X-WNS-NOTIFICATIONSTATUS: receivedX-WNS-MSG-ID: 1ACD59E4683FE4BFX-WNS-DEBUG-TRACE: DB3WNS4011434
Important NotesDevice can be offline or disconnected. Success indicates that the request was successfully received by WNS; not necessarily that the user saw it.Additional headers in the response for notification and device status.
![Page 18: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/18.jpg)
announcing
![Page 19: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/19.jpg)
Authentication Codeusing Windows.Recipes.Push.Notifications.Security;…// Constructor takes your Package SID and secret keyIAccessTokenProvider _tokenProvider = new WNSAccessTokenProvider(
"ms-app%3A%2F%2FS-1-15-2-1633617344-1232597856-4562071667-7893084900-2692585271-282905334-531217761",
"XEvTg3USjIpvdWLBFcv44sJHRKcid43QXWfNx3YiJ4g");
![Page 20: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/20.jpg)
Push Notification Codeusing Windows.Recipes.Push.Notifications;…var toast = new ToastNotification(_tokenProvider);toast.ChannelUrl = "https://db3.notify.windows.com/?token=AQI8iP%2OtQE%3d";toast.ToastType = ToastType.ToastImageAndText02;toast.Image = "https://demosa.blob.core.windows.net/toastImg1.png";toast.Text = new List<string> {"Miguel Saenz comment on your status", "I love that quote! How have you …"};
NotificationSendResult result = toast.Send();
![Page 21: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/21.jpg)
What a service needs to support
How do I do that with Windows Azure?
![Page 22: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/22.jpg)
announcing
![Page 23: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/23.jpg)
![Page 24: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/24.jpg)
Core Services Services to Help Scale
![Page 25: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/25.jpg)
Recap
![Page 26: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/26.jpg)
Session RecapThere are 3 easy steps to implement push notifications:
The Windows Push Notification Recipe helps you easily add push notifications to your serviceThe Windows Azure Toolkit for Windows 8 is the best way to start building a serviceWindows Azure provides the resources to scale your services as your app grows
![Page 27: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/27.jpg)
ResourcesRegister your apphttp://manage.dev.live.com/build
Download the Windows Azure Toolkit for Windows 8 http://WATWindows8.codeplex.com
Windows 8 Developer Documentationhttp://dev.windows.com
![Page 28: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/28.jpg)
Sessions[APP-396T] Using tiles and notifications[SAC-850T] Getting started with Windows Azure[SAC-858T] Identity and access management for Windows Azure apps[SAC-868T] Building device & cloud apps[SAC-869T] Building global and highly-available services using Windows Azure[SAC-870T] Building scalable web apps with Windows Azure[SAC-871T] Building social games for Windows 8 with Windows Azure[SAC-961T] Inside Windows Azure storage: what's new and under the hood deep dive
![Page 29: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/29.jpg)
FeedbackFeedback and questions: http://forums.dev.windows.com Session feedback: http://bldw.in/SessionFeedback
![Page 30: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/30.jpg)
Thank You
![Page 31: Delivering Notifications With Windows Azure](https://reader036.fdocuments.net/reader036/viewer/2022062400/5681685d550346895dde9a82/html5/thumbnails/31.jpg)
© 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION
IN THIS PRESENTATION.