Building Connected Windows 8 Apps with Windows Azure Web Sites Name Title Organization
Basic Connectivity Media Location Push Notifications Agenda
Fundamentals
Compute: What are our Options? Virtualization O/S Hardware Native Code Custom Software Network Data Applications Firewall Applications Data Native Code Startup Tasks Applications Firewall Rules Data Virtual Network Native Code Custom Software Virtual Network Data Applications Firewall Rules O/S Applications Data Auth Notifications
Storage: What are our options? Benefits: Non-relational structured storage Massive scale-out Tables Storage Benefits: Big files Windows Azure Blobs Benefits: Persistent Async Messaging Enqueue, Dequeue Windows Azure Queues Benefits: Relational database Highly available Managed for you as a service SQL Database
Windows 8 Style UI Apps: Language Support JS/HTML C#/XAML C++ WinRT API Today HttpClient Media CameraCaptureUI Location Geolocator Notifications PushNotificationChannelManager
Basic Connectivity
Demo
Key Takeaway: Serialization format matters - Drivers T22:12:38Z T22:12:38Z Rob Tiffany T22:12:38Z Loke Uei Tan T22:12:38Z Dan Bouie T22:12:38Z John Dietz T22:12:38Z Derek Snyder T22:12:38Z Steve Hegenderfer T22:12:38Z Chip Vollers T22:12:38Z James Pratt The same list of 8 Customers using SOAP and a DataSet dropped us down to 3 kb but still too big for my taste. 1 1 Rob Tiffany 2 1 Loke Uei Tan 3 1 Dan Bouie 4 1 John Dietz 5 2 Derek Snyder 6 2 Steve Hegenderfer 7 2 Chip Vollers 8 2 James Pratt OData 8.5kb <ArrayOfDriver xmlns= xmlns:i=" 1 1 Rob Tiffany 1 2 Loke Uei Tan 1 3 Dan Bouie 1 4 John Dietz 2 5 Derek Snyder 2 6 Steve Hegenderfer 2 7 Chip Vollers 2 8 James Pratt REST-XML 1.2kb [{"DistributionCenterId":1,"DriverId":1,"FirstName":“Nick","LastName":"Harris"}, {"DistributionCenterId":1,"DriverId":2,"FirstName":“Rob","LastName":“Tiffany"}, {"DistributionCenterId":1,"DriverId":3,"FirstName":"Dan","LastName":"Bouie"}, {"DistributionCenterId":1,"DriverId":4,"FirstName":"John","LastName":"Dietz"}, {"DistributionCenterId":2,"DriverId":5,"FirstName":"Derek","LastName":"Snyder"}, {"DistributionCenterId":2,"DriverId":6,"FirstName":"Steve","LastName":“Harris"}, {"DistributionCenterId":2,"DriverId":7,"FirstName":"Chip","LastName":"Vollers"}, {"DistributionCenterId":2,"DriverId":8,"FirstName":"James","LastName":"Pratt"}] JSON 639 bytes
Media
Storage: How do we keep secrets secret? Proxy the requests Client sends data to web role Web role sends data to storage (1) (2) Web Role
Storage: Using Shared Access Signatures Client makes request of Web Role for SAS Web Role sends client SAS Client makes Read Request or Writes direct Client gets response (1) (3) Web Role (2) (4)
Demo
Next Steps Optimize storage calls of CreateIfNotExist Larger files upload blocks in parallel to the blob Windows Azure CDN Windows Azure Media Services Use CloudConfigurationManager to allow portability between WAWs and Cloud Services
Geolocation
Location Basics
Demo
using System.Data.Spatial; namespace GeoLocation.Models { public class PointOfInterest { public Guid Id { get; set; } [StringLength(200)] public string Description { get; set; } public PointOfInterstType Type { get; set; } public string Url { get; set; } public DbGeography Location { get; set; } } } public class LocationContext : DbContext { public DbSet PointOfInterest { get; set; } } using (var db = new LocationContext()) { return db.PointOfInterest.Where(p => p.Location.Distance(origin) <= radiusInMeters); } EF vs >= 5.0 with Spatial Data
Push Notifications
Push Notification Lifecycle Windows 8 (1) (2) (3)
Demo
Handle MessageSendResult Implement Notifications in a Worker Role There is a very rich set of notification templates available in Windows 8. Become familiar with them: Win8TileTypes – Win8ToastTypes – Win8BadgeTypes – Next Steps Try the NuGets
Application Building Blocks
~1.25hr using Windows 8 + Windows Azure Basic Connectivity Media Location Push Notifications Summary
Download the Sample Source: windows-azure/ Watch the video Note: For the sample you will need to update the storage account name+key and update the SQL connection string Sample Source
© 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.