Top Banner
Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure
41

Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Dec 18, 2015

Download

Documents

Alice Reeves
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Push to ALL the iPhones with AzureChris RisnerSenior Technical Evangelist@chrisrisner Microsoft Azure

Page 2: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

2

About me

Technical Evangelist @chrisrisner

Chrisrisner.com Live in Washington

Grew up in MichiganMobile dev for 5+

years

Page 3: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

3

Agenda

Push Notifications Microsoft Azure

Azure Notification Hubs

Tags

Templates Questions

Page 4: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Push Notifications are BIG

Provide updates to

users

Alert users when app isn’t

running

Trigger background

sync

Pull users back into your apps!

Page 5: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Emails•Game updates•Flight reminder•Rental car reminder•Appointments•Video chat requests•Data usage alerts•Bills due

Push Notifications I Receive

Page 6: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Challenges of push notifications

Platform dependency• Different communication protocols to PNS’ (e.g. HTTP vs TCP, xml payload vs json payload)• Different presentation formats and capabilities (tiles vs toasts vs badges)

Routing• PNS’ provide a way to send a message to a device/channel• Usually notifications are targeted at users or interest groups (e.g. employees assigned to a

customer account)• App back-end has to maintain a registry associating device handles to interest groups/users

Scale• App back-end has to store current handles for each device high storage and VM costs• Broadcast to millions of devices with low latency requires parallelization (DB ad VM)

Page 7: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Push Notification Lifecycle1. App registers with provider2. App gets token3. App sends token to backend4. Push requested5. Backend delivers push to provider6. Provider pushes to device

7

PlatformNotification

Service

App back-end

Page 8: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Microsoft Azure

Backend-as-a-Service

~consume

BaaSPlatform-as-a-Service

build

PaaSInfrastructure-as-a-

Service

host

IaaSSoftware-as-a-Service

consume

SaaS

Page 9: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Notification Hubs• Cross-platform Push Notifications• Highly scalable• Managed

Page 10: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Client SDKs for• Android – GCM and ADM• iOS – APNS• Windows Phone – MPNS• Windows Store – WNS

•Capable of pushing to specific platform or to all at once•Server SDKs for

• REST API• .NET• Node.JS• Java

Cross-Platform Push

Page 11: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Part of Azure Service Bus•Three levels of scale• Free (1 million)• Basic• Standard

•Millions of push notifications in minutes

Highly Scalable

Page 12: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Notification Hubs deals with• Storing device registration information• Signing push requests and sending to PNS• Dealing with invalid push ID registrations• Handling templates and tags

• You just need to• Configure your hub and app• Register with the PNS• Pass along the push ID

Managed

Page 13: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

1. App registers with provider2. App gets token3. App sends token to Hub4. Push requested5. Hub delivers push to provider6. Provider pushes to device• Hub handles expired tokens

Using Notification Hubs

APNsWNS

Notification Hub

App back-end

iOS app Windows app

MPNS

GCM

ADM

Page 14: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Demo: HubsCreating a HubConfiguring a HubRegister and Push

Page 15: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Tags

Page 16: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Clients register with set of tags•Tags are strings tied to the Push ID•Requests to push to a Tag will push to connected Push IDs•“Interest based push”

Tags

Page 17: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Tags: Example

Notification Hub

App back-end

Tag:”Tablet”Tag:”Phone”

Tag:”Tablet”

Page 18: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Conference name•Username•Zip code•Sports team•Band name•Stock ticker

Other Tag Usages

Page 19: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Demo: TagsRegistering with TagsPushing with Tags

Page 20: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

• Logic based tag pushed• Social: “All of this group but me”• Group:id && !user:id

•Version and platform• Version:1.0 && platform:iOS

• Events: “Anyone interested in the game”• FollowTeam:SeaHawks || FollowTeam:Broncos || EventInterest:SuperBowl

Tag Expressions

Page 21: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Geo Push

Page 22: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

1. Client requests location2. Client uses reverse geocoding service to get zip

(etc)3. Client registers with Hubs using zip as a tag4. Server pushes to zip code5. All clients in that zip code receive notification

Making GeoPush Work

Page 23: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Demo: Geo Push

Page 24: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Templates

Page 25: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Clients can specify templates when registering•Templates specify format of payload when specific push is sent• If “Message” push is sent, send it in this format { alert : “$info” }

•Enables app backend to send platform independent messages• i.e. push to all the devices with this tag

•Multiple templates per device•Different tags per template

Templates

Page 26: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Demo: TemplatesRegistering with TemplatesPush to all the devices!

Page 27: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Client vs Server Registration

Page 28: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Client app talks directly with Notification Hub•Sends over the wire• Push ID (Channel URI, Registration ID, Token)• Tags• Templates•Notification Hub Listen Connection String

•Not completely secure

Registering from the Client

Page 29: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Authenticate the request before registering• Is the user who they say they are?

•Can still specify tags and templates•Great for setting up registrations from a web app•Good for when an app update requires a user’s registrations being updated• i.e. manager adding an employee to a group

Registering from the Server

Page 30: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Registering from the Server

Notification HubApp back-

end

{id}

upsert({id}, channel, tags)

createId()

Page 31: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Demo: Server Registration

Page 32: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Push-to-Sync

Page 33: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

•Different support on different platforms•Windows / Windows Phone – Only Lock Screen Apps• iOS – only iOS 7 and up• Android / Kindle

•Useful in scenarios where push isn’t satisfactory• Too much data to fit in payload•Don’t want to send secure information through PNS

Push-to-Sync

Page 34: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Notification Hubs• Cross-platform Push Notifications• Highly scalable• Managed

Page 35: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

35

Resources• Get a FREE Microsoft Azure Trial Account:

• http://azure.microsoft.com

• Check out Notification Hubs• http://aka.ms/NH

• SDK Source Code on GitHub• https://github.com/Azure/azure-notificationhubs

• Contact Details• http://chrisrisner.com• http://aka.ms/CommonWams• @chrisrisner• [email protected]

Microsoft Azure

Page 36: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Thanks!Questions?

Page 37: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

© 2014 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.

Page 38: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Azure footprint

16 regions worldwide in 2014

Page 39: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Fortune 500 using Azure

>57%

>250kActive websites

Greater than

1,000,000

SQL Databases in Azure>20 TRILLION

storageobjects

>300

MILLIONAD users

>13BILLIONauthentication/wk

>2 MILLION

requests/sec

>1 MILLION

Developers registered with Visual Studio Online

Page 40: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.
Page 41: Push to ALL the iPhones with Azure Chris Risner Senior Technical Evangelist @chrisrisner Microsoft Azure.

Get startedVisit azure.microsoft.com