DEV Community

Nubo Mail
Nubo Mail

Posted on

Real-Time Email: How JMAP Push Eliminates the 15-Minute Delay

Real-Time Email: How JMAP Push Eliminates the 15-Minute Delay

Open your email settings on any traditional email client. Somewhere in there, you will find a setting that says 'Check for new mail every X minutes.' The default is usually 15 minutes.

This is polling, and it is the reason your urgent email sat unread for 14 minutes while you stared at an empty inbox.

The Polling Problem

IMAP was designed with a pull model. The client connects to the server and asks: 'Do you have anything new?' The server responds, and the client disconnects (or sits idle).

IMAP IDLE was introduced to help — the client holds a connection open and the server notifies it of changes. But IDLE has problems:

  • Only works on one mailbox at a time
  • NAT timeouts kill the connection after 5-30 minutes
  • Mobile networks aggressively close idle connections
  • Each IDLE connection consumes server resources

The result: most email clients fall back to polling.

JMAP Push: A Different Approach

JMAP was designed with real-time delivery as a core requirement, not an afterthought. It supports two push mechanisms:

WebSocket (RFC 8887)

A persistent WebSocket connection between client and server. When anything changes — new email, calendar update, contact modification — the server sends a notification through the open channel. The client then fetches only the changed data.

EventSource (Server-Sent Events)

For environments where WebSocket is not available (some corporate firewalls block it), JMAP falls back to EventSource. This is a one-way streaming connection over standard HTTP — compatible with virtually any network configuration.

State-Based Synchronization

The real power of JMAP push is not just the notification — it is how synchronization works after the notification arrives.

Every JMAP response includes a state token. When the client receives a push notification, it sends its last known state token and asks: 'What changed since this state?' The server responds with only the delta — new emails, changed flags, moved messages.

Compare this to IMAP, where detecting changes often requires re-scanning the entire mailbox.

Impact on User Experience

At Nubo.Email, JMAP push means:

  • New email notification: Under 1 second from server receipt to client display
  • Multi-device sync: Read an email on your phone, it is instantly marked read on your desktop
  • Calendar updates: Accept an invitation on one device, all devices update immediately
  • Battery life: No background polling means significantly less CPU and radio usage on mobile

Implementation Details

Our implementation uses a layered approach:

  • Primary: WebSocket connection for lowest latency
  • Fallback: EventSource for restricted networks
  • Safety net: Periodic sync (every 30 seconds) as final fallback
  • Keep-alive: Regular pings to detect connection drops
  • Auto-reconnect: Exponential backoff on connection failures

The client manages all three strategies transparently. Users never need to configure anything — they just see emails arrive instantly.

For Developers

If you are building email features, JMAP push is significantly simpler to implement than IMAP IDLE:

  • Standard WebSocket or EventSource — well-supported in every language
  • JSON payloads — easy to parse and debug
  • State tokens — no complex synchronization logic
  • Single connection — covers all mailboxes and data types

The future of email is real-time. Users expect it. JMAP delivers it.

Top comments (0)