← All posts

Product · · 3 min read

Realtime Chat Presence and Read Receipts

Learn how realtime chat presence and read receipts work, and how to separate transient realtime events from durable chat data.

ByoTalk developer guide showing a realtime chat interface with presence, read receipts, React integration, and support for a customer's own database.

Realtime chat presence and read receipts make conversations feel immediate and trustworthy. Presence tells users whether someone is online or away, while read receipts show whether a message has been seen. The challenge is making both features reliable without forcing your application to own all of the realtime infrastructure.

What chat presence actually means

Presence is more than an online badge. A production chat system needs to represent states such as online, offline, idle, and sometimes typing. Those states change frequently, so they should be treated as transient realtime data rather than permanent business records.

A useful architecture keeps presence separate from durable message storage. The realtime layer can track connection state and broadcast changes, while your own database remains the source of truth for conversations and messages.

How read receipts work

A read receipt usually records the point at which a user has consumed messages in a conversation. Instead of storing a separate read record for every message, many systems store a conversation-level cursor such as the latest message ID or timestamp that a participant has read.

When the user opens a conversation, the client sends an acknowledgement. The realtime layer distributes that update to the other participants, and the application can persist the durable state in its own database.

This approach keeps the event flow efficient while still allowing the database to answer questions such as which messages have been read.

A practical architecture

A clean realtime chat architecture can be split into three responsibilities:

  1. Client: renders messages, presence, and receipt states.
  2. Realtime layer: delivers events quickly between connected clients.
  3. Database: stores permanent conversations, messages, and read state.

This separation matters because presence and delivery events can be frequent, while permanent records need stronger durability.

For a managed approach, ByoTalk can handle the realtime delivery, synchronization, receipts, and presence while your application's own database keeps the permanent record.

Common implementation mistakes

One common mistake is treating every presence event as permanent database data. Presence can change many times during a session, so writing every heartbeat directly to your primary database can create unnecessary load.

Another mistake is assuming that message delivery means a message has been read. Delivery only tells you that the recipient's client received the message. A read receipt should be generated from an explicit read event, normally when the conversation is visible to the user.

You should also design for reconnects. Mobile clients lose connectivity regularly, and the system should recover without creating duplicate messages or incorrect receipt states.

Designing for reconnects

Use stable message IDs and idempotent events so a client can safely retry after a connection interruption. The server should be able to recognize an already-processed acknowledgement instead of creating another state transition.

For presence, reconnecting should create a fresh presence session rather than assuming the previous connection is still active. Timeouts or heartbeats can help the realtime layer detect stale connections.

When to build it yourself

Building realtime chat infrastructure yourself can make sense when realtime behavior is a core differentiator and your team has the operational capacity to maintain connections, synchronization, scaling, retries, presence, receipts, and monitoring.

For teams that mainly need reliable chat inside an existing product, separating realtime infrastructure from the application's permanent database can reduce engineering overhead.

FAQ

Are read receipts the same as delivery receipts?

No. A delivery receipt indicates that a message reached the recipient's client. A read receipt indicates that the recipient actually consumed the message.

Should presence be stored in the main database?

Usually, only durable presence-related information belongs there. Short-lived online/offline state is better handled by the realtime layer.

Can I keep chat messages in my own database?

Yes. A BYO-database architecture lets your application retain ownership of permanent message data while a realtime service handles delivery and synchronization.

Build realtime chat without rebuilding the infrastructure

If you are evaluating realtime chat architecture, start by separating transient events from durable data. Your application can keep ownership of the database while a dedicated realtime layer handles delivery, synchronization, presence, and receipts.

See also: How to Build Realtime Chat Without WebSockets and Introducing ByoTalk: realtime chat that writes to your own database.

  • chat-infrastructure
  • realtime
  • byo-database

Build chat on ByoTalk

Realtime chat and calls, with the permanent record in your own database.