web push notifications€¦ · fcm: google, free (former gcm) register and create application key...

32
Web Push Notifications

Upload: others

Post on 31-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Web Push Notifications

Page 2: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Whois

● They are for push

Page 3: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

● They are for push● Timely

Whois

Page 4: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

● They are for push● Timely● Relevant and Secure

Whois

Page 5: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

● They are for push● Timely● Relevant and Secure● "Cross-platform" and "Cross-browser"

Whois

Page 6: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

"Cross-platform" and "Cross-browser"

● Service Workers background

● Push API receive messages from the server

● Notification API display messages natively

Page 7: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

"Cross-platform" and "Cross-browser"

Desktop

+ Chrome+ Firefox+ Opera+ Safari

Mobile (not iOS yet)

+ Chrome+ Firefox+ Opera

Page 8: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Push API

Notification API

Service Workers

Page 9: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Your App

Message ServerClient

How it works

2

1

3

4

4

Page 10: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Message Server

Sends message to your customers● Accepts requests from your application ● Application key and Client token must have● Dispatch message to the destination device

Page 11: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Message Server

● FCM: Google, free (former GCM)Register and create application key in developer console

● APNS: Apple, needs certified developer or 100$ annually● MSP: Mozilla Push Service, free. No registration required, open

standard

Page 12: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:
Page 13: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Your App

Message ServerClient

How it works

1

Subscribe, ask for client token

Page 14: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:
Page 15: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Your App

Message ServerClient

How it works

2

1

Get client token from Message Server

Page 16: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:
Page 17: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Your App

Message ServerClient

How it works

2

1

3

Return client token to the web app

Page 18: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:
Page 19: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Your App

Message ServerClient

How it works

2

1

3

4

4

Send notification to tokenized endpoint

Enqueue messagedispatch

Page 20: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

https://firebase.google.com/docs/cloud-messaging/http-server-ref

Page 21: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:
Page 22: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

https://firebase.google.com/docs/cloud-messaging/http-server-ref

Page 23: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

https://firebase.google.com/docs/cloud-messaging/http-server-ref

Page 24: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:
Page 25: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

messaging.onMessage event

Page 26: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

TTL (1 month by default)

Page 27: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

On time

Page 28: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

The Firebase JavaScript SDK way

● Only client token needed, no encrypting payloads● Custom features● Supports Android, iOS and web● Easy to use

The VAPID way

● No sender_id required● Chrome, Firefox supported (more will join)● No Account with GCM required● Tends to replace proprietary API

Page 29: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:
Page 30: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

:(● No guarantee of delivery (even if browser opened and sw works)● Still no wide support● Every device needs to be registered● ...

Page 31: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

https://www.urbanairship.comhttps://pushpad.xyzhttps://www1.vizury.comhttps://moengage.com

etc.

Why bother?

Page 32: Web Push Notifications€¦ · FCM: Google, free (former GCM) Register and create application key in developer console APNS: Apple, needs certified developer or 100$ annually MSP:

Demo to playhttps://killoff.github.io/serviceworker/

Referenceshttps://developers.google.com/web/fundamentals/push-notifications/https://developers.google.com/web/updates/2016/07/web-push-interop-winshttps://firebase.google.comhttps://medium.com/@firt/progressive-web-apps-on-ios-are-here-d00430dee3a7https://github.com/digitaldrk/push_notifications

Q & A