You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/pages/docs/guides/pub-sub/notifications-center.mdx
+10-53Lines changed: 10 additions & 53 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -405,71 +405,30 @@ Server-side tracking is also possible with [message annotations](/docs/messages/
405
405
406
406
#### Tracking via message ID
407
407
408
-
Each message has a unique [`id`](/docs/api/realtime-sdk/types#message) assigned by Ably. If your client stores the `id` of the last message it successfully processed, you can query history and stop processing when you encounter that message:
408
+
Each message has a unique [`id`](/docs/api/realtime-sdk/types#message) assigned by Ably. Clients can track which messages they've processed by storing the last message ID. When reconnecting, they can query history to retrieve any missed notifications.
409
409
410
410
<Code>
411
411
```javascript
412
412
constinbox=ably.channels.get('inbox:client456');
413
413
414
-
// Retrieve the last processed message ID and timestamp from local storage
The `start` parameter is inclusive and helps limit the query range to messages from that timestamp onwards, but you still need to check `message.id` to detect which specific message you last processed. This approach works because history with `untilAttach: true` returns messages in reverse order, allowing you to paginate backwards and stop when you find the last message you've already seen.
467
-
468
-
Message history is particularly useful for notifications that clients need to see when they return, but that don't require immediate push notification delivery. This is common in internal systems where notifications might inform clients of completed processes, status updates, or system alerts that can be reviewed when a client connects.
469
-
470
-
<Asidedata-type='note'>
471
-
History returns a paginated list of messages. As such, you may need to paginate through multiple pages to find the last processed message, depending on how many messages were sent while the client was offline.
472
-
</Aside>
431
+
History queries can be paginated if needed, allowing you to retrieve larger sets of missed notifications across multiple requests.
473
432
474
433
#### Tracking via message annotations
475
434
@@ -572,8 +531,6 @@ Before launching your notification center, review these key points:
572
531
573
532
* **Authentication:** Use JWT authentication for all client-side communication with short TTLs (1-4 hours max).
574
533
* **Capabilities:** Apply the principle of least privilege - clients should only have subscribe access to their own inbox channels.
575
-
* **Validation:** Validate all notification request data in your backend, never trust client data.
576
-
* **Monitoring:** Subscribe to [`[meta]log` channels](/docs/platform/errors#meta) to track publishing errors and issues.
577
534
* **Rate limiting:** Implement rate limiting in your backend to help prevent abuse.
578
535
* **Scalability:** Ensure your backend can scale horizontally to handle request and publishing load.
579
536
* **Cost monitoring:** Set up billing alerts and monitor usage patterns to optimize costs.
0 commit comments