Realtime Notifications Architecture: Designing Reliable Push, Retry, and Preference Workflows
realtimenotificationsWebSocketspush notificationsevent-driven architecture

Realtime Notifications Architecture: Designing Reliable Push, Retry, and Preference Workflows

MMessages Solutions Editorial Team
2026-12-04
8 min read

Design a reliable realtime notification workflow and estimate delivery volume, retries, capacity, and cost with repeatable inputs.

A reliable realtime notification system separates event capture, delivery decisions, and channel-specific sending. This guide shows how to design that workflow, estimate notification volume and operating cost with repeatable inputs, and choose sensible retry, preference, deduplication, and offline-delivery rules.

Overview

A notification is not just a message sent to a browser or phone. It is the result of a workflow that starts with a business event and ends with one or more delivery attempts. Treating it as a workflow makes reliability measurable and prevents channel providers, user preferences, or temporary outages from affecting core application transactions.

A practical notification service usually contains these stages:

  1. Event ingestion: An application publishes an event such as invoice.ready, comment.created, or incident.opened.
  2. Normalization: The service validates the event, assigns an identifier, records its schema version, and extracts the recipient or audience.
  3. Preference evaluation: The service checks opt-outs, quiet hours, notification categories, tenant rules, and channel eligibility.
  4. Fanout: One event becomes one or more recipient-channel jobs. A single event might produce an in-app notification, an email, and a mobile push attempt.
  5. Delivery: Workers send messages through WebSockets, server-sent events, a mobile push provider, email, or another channel.
  6. Recording: The system stores status, attempt count, timestamps, provider responses, and a correlation ID for audit and support use.

Keep the source event separate from the delivery job. This allows the same business event to be retried, delivered through another channel, or reviewed later without repeating the original business action. A queue is useful for smoothing bursts and isolating provider failures; a stream can be useful when several independent consumers need the same event history. For background on that distinction, see the Kafka vs. RabbitMQ comparison.

Compare delivery channels before estimating capacity

ChannelBest fitKey constraintOffline approach
WebSocketsInteractive in-app updates and presence-sensitive experiencesRequires connection management, authentication, and fanout capacityPersist an unread item and deliver it after reconnect
Server-sent eventsOne-way browser updates from server to clientLong-lived HTTP connections and reconnect behavior need careful handlingUse a cursor or last-event identifier to catch up
Mobile pushReaching a mobile user when the app is not activeProvider behavior, device state, token validity, and platform limits varyStore the notification in an in-app inbox as the durable record
PollingSimple integrations, low urgency, or environments where persistent connections are unsuitableCreates repeated requests and can increase latency or read loadReturn items newer than a client cursor or timestamp

WebSockets and server-sent events are transport mechanisms, not durable storage. If a user must be able to find a notification later, write it to an inbox or notification history before attempting realtime delivery. The WebSocket scalability checklist covers connection state, fanout, and operational concerns in more detail.

How to estimate

Estimate the system in layers rather than starting with a provider bill. The basic unit is a delivery attempt, not a business event.

Monthly delivery attempts = monthly events × eligible recipients per event × channels per recipient × attempts per delivery.

This is a planning model, not a quotation. It helps compare architecture options and exposes which assumption drives the result. Add separate estimates for persistent connections, event storage, queue operations, provider requests, and observability data where those are billed or capacity-limited independently.

Use a scenario worksheet

  1. Count business events by category, such as transactional, collaboration, security, and marketing-related events.
  2. Estimate the average and peak number of eligible recipients. Do not use the total account population unless every event reaches every account.
  3. List channels enabled for each category. A high-priority security event may use push and email, while a routine collaboration event may use only in-app delivery.
  4. Estimate first-attempt success and retry behavior. Model retries by category because a transient provider failure and an invalid device token have different outcomes.
  5. Add durable storage and retention. An inbox retained for 90 days has a different storage profile from an audit record retained for several years.
  6. Model peak concurrency separately from monthly volume. Connection count, fanout rate, queue depth, and provider throughput can become bottlenecks even when the monthly total appears modest.

For a more complete decision, track four outputs: estimated delivery attempts, peak jobs per second, concurrent realtime connections, and retained notification records. These outputs map more directly to design and capacity decisions than a single total-message number.

Inputs and assumptions

Write assumptions beside every estimate so the worksheet can be updated without rebuilding it. Useful inputs include:

  • Event volume: Events per day or month, divided by notification category.
  • Recipient fanout: Average recipients and a separate worst-case audience for broadcasts or large groups.
  • Channel mix: The percentage of eligible users who have each channel enabled and available.
  • Retry policy: Maximum attempts, backoff intervals, and which errors are retryable.
  • Peak multiplier: The factor used to convert average traffic into a design peak. Choose it from observed traffic when possible rather than treating it as a universal constant.
  • Connection profile: Concurrent connections, reconnect rate, messages per connection, and expected payload size.
  • Retention: How long notification history, delivery logs, and failed jobs remain available.
  • Preference rules: Quiet hours, category settings, tenant policies, and legal or product requirements that suppress delivery.

Use stable identifiers for both the source event and each delivery job. A deduplication key can combine an event ID, recipient ID, channel, and notification purpose. Store the key long enough to cover the likely replay and retry window. Idempotent workers should safely process the same job more than once without creating duplicate inbox records or repeated side effects.

Retry only failures that may recover. Network timeouts, temporary unavailability, and selected server responses can enter a delayed retry queue. Invalid tokens, malformed payloads, revoked access, and explicit preference suppression should generally be marked permanent failures or routed to a cleanup workflow. Use exponential backoff with jitter, a maximum delay, and a dead-letter queue for jobs that exceed the attempt limit. See the guidance on message delivery guarantees and backpressure when defining these controls.

For WebSocket authentication, authorize the connection and each relevant subscription rather than assuming that an authenticated socket may receive every event. Token expiration, rotation, and reconnect behavior should be explicit; the JWT for WebSockets checklist provides a useful review framework.

Worked examples

Consider a planning scenario with 200,000 source events per month. Each event reaches an average of 3 eligible recipients, and each recipient has an average of 1.4 enabled channels. The initial estimate is:

200,000 × 3 × 1.4 = 840,000 first delivery attempts per month.

Assume the retry model adds 8% additional attempts across the full workload:

840,000 × 1.08 = 907,200 total delivery attempts per month.

This number still does not describe peak load. If 12% of monthly attempts occur during the busiest day and 20% of that day’s traffic arrives during its busiest hour, the worksheet would estimate the approximate busy-hour attempts as:

907,200 × 0.12 × 0.20 = 21,772.8 attempts.

That figure can be converted into an approximate per-second planning rate by dividing by the number of seconds represented by the busy hour. More importantly, test whether the workload arrives evenly. A product launch, incident, or mass status change may create a short fanout burst that is much sharper than the monthly average.

Now compare two channel policies for the same event type. Policy A sends only an in-app WebSocket update and stores one inbox record. Policy B sends the update, a mobile push, and an email when the user is offline. Policy B may improve reach, but it creates more delivery jobs, more provider dependencies, more retry branches, and potentially higher operating cost. A preference-aware router should choose the least expensive channel set that meets the event’s urgency and user-experience requirement.

For a broadcast, replace the average recipient count with a separate broadcast scenario. If one event targets 50,000 recipients, calculate its fanout independently and test queue capacity, connection distribution, provider limits, and database write behavior. Do not hide this case inside an average; rare large fanouts often determine the architecture.

When to recalculate

Revisit the estimate whenever an input changes, not only when a provider changes its pricing or limits. Recalculate after adding a channel, changing default preferences, introducing group or broadcast notifications, increasing retention, or moving from polling to persistent connections. Also revisit it when product usage changes the average recipient count or when a new event type has a different urgency and retry policy.

Review the worksheet on a regular schedule and after major platform changes. Confirm provider pricing, quotas, payload constraints, token behavior, and SDK delivery semantics from current documentation before committing to a budget or launch plan. Treat those values as variables in the model rather than permanent facts.

Before production rollout, run a failure-focused test plan:

  • Disconnect clients during delivery and verify catch-up from the durable inbox or cursor.
  • Replay the same event and confirm deduplication.
  • Return temporary and permanent provider errors and verify separate handling.
  • Change a user preference between event creation and delivery.
  • Expire a WebSocket token and confirm safe reauthentication.
  • Create a large fanout and observe queue depth, consumer lag, connection load, and database pressure.
  • Inspect whether operators can trace a notification from source event to every channel attempt.

Keep a versioned worksheet with the date, assumptions, observed values, and resulting capacity targets. That turns notification planning into an operational habit: when volume, rates, or product rules move, update the inputs, rerun the scenarios, and adjust workers, queues, retention, or channel policy before the change becomes an incident.

Related Topics

#realtime#notifications#WebSockets#push notifications#event-driven architecture
M

Messages Solutions Editorial Team

Senior SEO Editor

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.