Publishing methods
You can publish push notifications to user devices or browsers in two ways:Direct publishing
Publishing directly sends push notifications to specific devices or browsers identified by unique identifiers, such as adeviceId or a clientId. This approach is akin to sending a personal message or alerts directly to an individual user’s device or browser, bypassing the need for channel subscriptions.
Direct publishing excels in:
- Targeted and personalized communications
- User-specific alerts and notifications
- Account notifications
- Customized updates based on user actions
Publishing via channels
Publishing via channels uses a Pub/Sub model. Messages are sent to channels to which multiple devices or browsers can subscribe. When a message is published to a channel, all devices or browsers subscribed to that channel receive the notification. This approach is particularly powerful for:- Broadcasting to multiple users simultaneously
- Group notifications
- Topic-based alerts
- Real-time updates to subscribers
Push notification process
Integrating push notifications into your application includes a few essential steps:Push notification lifecycle
The following diagram shows the push notification lifecycle:- Publish: Your app or server publishes a push notification to Ably
- Process: Ably processes and packages the notification
- Forward: Ably forwards the packaged message to the appropriate push notification service (FCM, APNs, or Web Push)
- Deliver: The push notification service delivers the notification to target devices or browsers
- Display: The notification appears on the user’s device or browser screen
Supported platforms
Mobile devices
- iOS: Via Apple Push Notification Service (APNs)
- Android: Via Firebase Cloud Messaging (FCM)
Web browsers
- Chrome, Firefox, Edge: Via Web Push API
- Safari: Via APNs for web
Push admin API
Ably’s push admin API is a set of functionalities designed for backend servers to manage push notification tasks:- Register devices or browsers for push notifications
- Manage subscriptions to specific channels
- Send push notifications directly to devices, browsers, or users
Required capabilities
Using the push Admin API requires explicit capabilities:- push-admin: Full API access, enables management of registrations and subscriptions for all devices or browsers
- push-subscribe: Designates a client as a push target device or browser. Can only manage its own registration and subscriptions
Error handling
Monitor push notification errors using the[meta]log:push metachannel:
Next steps
- Set up push notifications
- Learn about publishing push notifications
- Configure device activation
- Configure web push
