25
CocoaHeads – Paris 11th feb. 2015 Always up-to-date with Silent Push Notifications at

Silent push

Embed Size (px)

Citation preview

CocoaHeads – Paris 11th feb. 2015

Always up-to-date with

Silent Push Notifications at

CocoaHeads – Paris 11th feb. 2015

CocoaHeads – Paris 11th feb. 2015

Michel Guillet @guilletmichel

Hugo Cordier @HugoCrd

CocoaHeads – Paris 11th feb. 2015

Our previous attempt

• Cordova based App (Ionic)

CocoaHeads – Paris 11th feb. 2015

Cross-platform ain’t perfect

CocoaHeads – Paris 11th feb. 2015

Redefining the scope• Focus on our customer’s everyday job

• Always up-to-date

• Read-me only*

CocoaHeads – Paris 11th feb. 2015

Focus on our users

80% iOS

CocoaHeads – Paris 11th feb. 2015

Focus on our users

• Native iOS app

• iPhone only

• iOS 8+ (94% according to Apple*)

*on 10 Feb 2016

CocoaHeads – Paris 11th feb. 2015

What we did

CocoaHeads – Paris 11th feb. 2015

Let’s Swift all the thing!

• Development from Scratch.

• Very fond of static typed language.

• Could benefit from the hype.

• Hired a guy that was willing to do it.

CocoaHeads – Paris 11th feb. 2015

Let’s not REST all the thing!

• RESTful is elegant, but mobile needs efficiency

• 17 different mobile specific endpoints

(7 for content, 4 for subscription, 6 for user management)

• Compressed JSON

• Low latency backend

CocoaHeads – Paris 11th feb. 2015

“Real” offline mode

• Connection losses are rarely planned

• SMS are great: always up-to-date. Let’s mimic that!

• Subscribe to what you want

• Push only relevant content

• Video are out of the scope

CocoaHeads – Paris 11th feb. 2015

Our StackSetkeeper Mobile

HTTPS / JSON

NGINX

Custom Backend

Vert.x / JVM MongoDB

EC2 / Azure

Swift CoreData CocoaPods

Ansible

Jenkins

APNS

S3

Sendgrid

CocoaHeads – Paris 11th feb. 2015

Push System

CocoaHeads – Paris 11th feb. 2015

Push System: Registration

HTTP APIMongoDB

AuthenticationService

Notification Service

1.1 Login

2.1 Register

1.2 Authentication 1.3 Check user/session

2.2 Register device for user 2.3 Persists device

CocoaHeads – Paris 11th feb. 2015

Push System: NotifyHTTP API

Web Client - Update stuff- Create things- Do whatever

BusinessNotification

Service

MobileNotification

Service

Event creation

RightManagement

Service

Generateone notification

per user

MongoDBAPNS

Generateone notification

per user and device

CocoaHeads – Paris 11th feb. 2015

APNS

CocoaHeads – Paris 11th feb. 2015

Push notification{ "aps" : { "alert" : { "title" : "Game Request", "body" : "Bob wants to play poker", "action-loc-key" : "PLAY" }, "badge" : 5 }, "acme1" : "bar", "acme2" : [ "bang", "whiz" ] }

CocoaHeads – Paris 11th feb. 2015

Silent notification{ "aps": { "content-available": 1 }, "data": { "type": "OUTLINE", "projectId": "54a72065-45f0-46f6-aeab-1169f0b2abca" } }

CocoaHeads – Paris 11th feb. 2015

Silent notification• Great because you don’t need to ask permission

• Can wake up your app to do stuff

• Force quitted app can’t wake up

• Never-launched-since-last-reboot app can’t wake up

Exactly what we needed !

CocoaHeads – Paris 11th feb. 2015

APNS• Send notification over a TLS secured binary protocol.

• One mistake and you’re out.

• JSON payload (2KB max*)

• Only one notification cached for offline devices

• Push token are sensitive things

• Listen to the feedback channel

CocoaHeads – Paris 11th feb. 2015

Pitfalls

• Do not send notification to push token in the wrong environment

• You can connect with the production certificate in the test environment

• When deploying your own push server notification, beware of inactive connection.

CocoaHeads – Paris 11th feb. 2015

APNS 3.0• HTTP 2.0

• Real response

• Payload: 4KB max

• Feedback in real time

• Room for future improvement

CocoaHeads – Paris 11th feb. 2015

Q&A

CocoaHeads – Paris 11th feb. 2015

Thanks!