arcus-smart-home / arcusios

Apache License 2.0
25 stars 22 forks source link

Figure out multi-platform story for push notifications #30

Open AndrewX192 opened 4 years ago

AndrewX192 commented 4 years ago

Ideally, the iOS app should be deployed as some "Arcus Smart Home" or otherwise organization in the app store, so that end users can download the app and point it at their instance of the platform. Unfortunately, this seems to break the iOS push notification model, which expects that each release of the app gets it's push notifications from one place.

The naive approach would be to share the APNs credentials, it's unclear what the threat model is for these credentials. In the past, APNs device tokens were per-device, but they are now per-app. It appears that the APNs Provider authenticating doesn't provide a lot of value, but it still seems like the wrong approach.

The alternative would be to use some gateway (like https://pushy.me/), but new providers would still need to be added manually. The approach Home Assistant has gone with seems similar to this, where they have a gateway (I think https://ios-push.home-assistant.io/push) that seems to get the user's device token and message, and sends it to some shared gateway maintained by Home Assistant. Presumably, this has the APNS credentials and handles the actual messages to send to the device.

https://github.com/home-assistant/home-assistant/blob/80136f3591b0580a38ac9ef2babf2f79fd444272/homeassistant/components/ios/notify.py https://www.home-assistant.io/docs/ecosystem/ios/notifications/architecture/

AdvaitT17 commented 3 years ago

But HA iOS App uses sendPushNotification & checkRatelimits function https://github.com/home-assistant/mobile-apps-fcm-push