Skip to content

Add guide for building a scalable notifications center using Ably#2985

Open
splindsay-92 wants to merge 33 commits intomainfrom
docs/add-notification-center-guide
Open

Add guide for building a scalable notifications center using Ably#2985
splindsay-92 wants to merge 33 commits intomainfrom
docs/add-notification-center-guide

Conversation

@splindsay-92
Copy link
Copy Markdown
Contributor

@splindsay-92 splindsay-92 commented Nov 27, 2025

Description

Add a guide that focuses on building a notifications center with Ably pubsub using Ably integrations to perform pre-processing on outbound notifications.
FF-164

TODO: There are a few diagrams/images that might be useful, I will ask design once we are happy with the content.

Checklist

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Nov 27, 2025

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch docs/add-notification-center-guide

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@splindsay-92 splindsay-92 added the review-app Create a Heroku review app label Nov 28, 2025
@ably-ci ably-ci temporarily deployed to ably-docs-docs-add-noti-ymxnor November 28, 2025 10:13 Inactive
@splindsay-92 splindsay-92 requested a review from AndyTWF November 28, 2025 10:24
@splindsay-92 splindsay-92 marked this pull request as ready for review December 3, 2025 15:08
@GregHolmes GregHolmes force-pushed the docs/add-notification-center-guide branch from 166f898 to 627366b Compare December 5, 2025 10:17
Copy link
Copy Markdown
Contributor

@GregHolmes GregHolmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice guide! Just a few comments left.

@splindsay-92 splindsay-92 force-pushed the docs/add-notification-center-guide branch 2 times, most recently from 1908488 to f57d1bf Compare December 10, 2025 12:37
Copy link
Copy Markdown
Contributor

@m-hulbert m-hulbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments and questions, but this is looking good.


Clients may not always be online when a notification arrives. Ably provides multiple mechanisms to ensure they receive important notifications:

### Short-term message history
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this can really be classified as a method for handling offline notifications, as you'd need to know the duration each client has been offline for in order to ensure no notifications were missed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think tracking duration is a prohibitive problem, but perhaps this section would be better renamed to Temporary disconnections and focus only on connection recovery for short term?


The right integration depends on your throughput, ordering requirements, and infrastructure:

**AWS Lambda / Serverless Functions:**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is a bit overwhelming in terms of bold and bullets.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reworked this to use small paragraphs instead of the bullet/bold approach. I have kept the Recommended when: as I think its good to bring attention to this.

});

// Retrieve notifications received while offline
const historyPage = await inbox.history({ limit: 50, untilAttach:true });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this require some way of knowing which notifications they've previously seen or acknowledged?

Copy link
Copy Markdown
Contributor Author

@splindsay-92 splindsay-92 Dec 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll add in some detail around using the message.id field to check if a message has been handled.

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.

### Push notifications for critical alerts
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about discussing;

  • Direct vs channel publishing to matching up with your inbox vs general inbox pattern above?
  • Web push in certain scenarios.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to keep this diving too much into the push notifications guide, since this I think is all covered there. I've linked to that guide here too, although the link won't work until push notifications guide is merged.

@splindsay-92 splindsay-92 force-pushed the docs/add-notification-center-guide branch from f4e39f7 to bcfe837 Compare December 24, 2025 15:54
@splindsay-92 splindsay-92 force-pushed the docs/add-notification-center-guide branch from 0fe5e16 to 82ee806 Compare January 20, 2026 14:25
@AndyTWF AndyTWF added review-app Create a Heroku review app and removed review-app Create a Heroku review app labels Jan 20, 2026

Delivering notifications in realtime is critical for user engagement. Ably's [serverless architecture](/docs/platform/architecture) eliminates the need to manage websocket servers. It automatically scales to handle millions of concurrent connections without provisioning or maintenance, while handling all edge-cases around delivery, failover, and scaling.

For notifications that need to reach users even when they're offline, Ably integrates seamlessly with push notification services like [Apple Push Notification Service (APNS) and Firebase Cloud Messaging (FCM)](/docs/push), ensuring your users never miss important updates.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also include web push here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


When designing your notification center, consider the following channel structure:

<Code>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this needs to be a code snippet

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


The decision comes down to cost and frequency:

* **Individual inboxes:** are best when broadcast notifications are infrequent. You pay per message published and per user receiving it.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we're missing a key aspect here - what about when only one person should receive a notification? Notifications specific to a given user shouldn't be sent to everyone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The caveat above this on line 65 states,

For notifications that need to reach all clients, you have two architectural options:`

So we are only talking about the cases where you want to talk to all users. Perhaps this section isn't clear enough, though? I could change the title to Handling broadcasts?

</Code>

**History capability:**
Including the `history` capability allows clients to retrieve notifications they might have missed while offline.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this also something push would handle?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reworked this whole section to focus on push, history is now only briefly mentioned.

* Publish 1 notification to the general channel
* 10,000 clients are subscribed to the general channel
* Cost: 1 inbound message + 10,000 outbound messages = **10,001 messages**
* Plus: Channel attachment cost for 10,000 clients subscribed to the general channel
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same in Option 1 and 2. The billing dimension is connections, not attachments.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* Cost: 1 inbound message + 10,000 outbound messages = **10,001 messages**
* Plus: Channel attachment cost for 10,000 clients subscribed to the general channel

If clients are connected for an average of 4 hours per day:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The channel minutes are based on the channel being active, not who's connected to it.

* Channel minutes per client per day: 4 × 60 = 240 minutes
* Total channel minutes per month: 10,000 clients × 240 minutes × 30 days = **72,000,000 channel minutes/month**

#### Cost comparison
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given my comments above, I'll skip the remainder of the cost section for now


### Push notifications for critical alerts

For user-facing applications where notifications require attention even when the app is not running, push notifications can be used. These are particularly useful for social interactions, time-sensitive alerts, or critical updates that users should act upon immediately.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally like to see this session moved up and given more prominence - I think push is a key feature for notifications (more so than annotations). I would have expected it to form a core part of the solution.

@splindsay-92 splindsay-92 force-pushed the docs/add-notification-center-guide branch from 5484fad to df84cdb Compare February 2, 2026 14:46
@splindsay-92 splindsay-92 requested a review from AndyTWF February 9, 2026 18:29
@m-hulbert m-hulbert temporarily deployed to ably-docs-docs-add-noti-jxi4vp February 11, 2026 15:29 Inactive

Delivering notifications in realtime is critical for user engagement. Ably's [serverless architecture](/docs/platform/architecture) eliminates the need to manage websocket servers. It automatically scales to handle millions of concurrent connections without provisioning or maintenance, while handling all edge-cases around delivery, failover, and scaling.

For notifications that need to reach users even when they're offline, Ably integrates seamlessly with push notification services like [Apple Push Notification Service](https://developer.apple.com/notifications/) (APNS), [Firebase Cloud Messaging](https://firebase.google.com/docs/cloud-messaging) (FCM)] and [web push](https://developer.mozilla.org/en-US/docs/Web/API/Push_API), ensuring your users never miss important updates.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra square bracket after FCM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

5 participants