An in-app chat feature looks simple: a text box and a list of bubbles. Underneath, it involves persistent connections, message ordering, delivery status, media uploads, notifications and safety controls.
This guide explains the main choices: build or buy, how real-time messaging works, what to store, how to handle media and moderation, and how to scale. It is written for founders and product owners who need to make informed decisions with their developers.
Is chat a core feature or a supporting one?
Start with the role chat plays. In a dating or social app, chat is part of the main experience. In a marketplace or booking app, it often supports a transaction: a customer asks a provider about timing or requirements. In a support tool, it connects users with your team.
This matters because core chat deserves custom design, careful data ownership and deeper investment, while supporting chat can often use a ready-made service. Be honest about which one you have.
Should you use a chat SDK or build it yourself?
Hosted chat services provide ready-made APIs, UI kits, storage and delivery. You pay usage-based fees and accept their limits. Building yourself means more engineering, but you control cost at scale, data and every behaviour. Check current pricing and terms of any provider, as these change.
- SDK or hosted service: faster launch, less infrastructure, predictable features. Trade-offs: recurring fees, less flexibility, data held by a third party.
- Custom build: full control over data, moderation and cost per message. Trade-offs: longer build, more testing and ongoing operations.
- Hybrid: use a hosted service for the MVP and plan a migration path if chat becomes core.
How does real-time chat architecture work?
Normal app requests are one-off: the app asks, the server answers. Chat needs the server to push messages to a user the moment they arrive. The common tool is a persistent WebSocket connection between the app and a chat service. Alternatives include server-sent events and, for simple cases, polling, which is easy but wasteful and slower.
The flow is: the sender's app sends a message to the server, the server validates and saves it, then delivers it to the recipient's open connection. If the recipient is offline, the server stores it and sends a push notification. When the app reopens, it fetches missed messages. Never rely on the live connection alone, since mobile networks drop constantly. Good push notification practice is part of a chat design, not an extra.
What data does a chat system need to store?
At minimum you need conversations, participants, messages and delivery states. Each message needs a unique ID, a conversation ID, sender, timestamp, content type and status. Use server-generated timestamps or sequence numbers to keep order consistent across devices.
Delivery states usually include sent, delivered and read. Decide whether to show read receipts at all, as some users dislike them. Also decide retention: how long you keep messages, whether users can delete them, and what happens when an account is deleted. These choices have privacy consequences, so review the DPDP Act considerations with a professional.
Message history grows fast. Plan pagination, so the app loads recent messages first, and local caching, so chats open instantly and work briefly offline.
How should media sharing work?
Do not send images or video through the same channel as text. The standard pattern is to upload the file to object storage, get a URL or file ID, and send that reference as the chat message. The recipient's app then downloads a thumbnail first and the full file on demand.
Set file size and type limits, compress images on the device, and scan uploads where possible. Large video can be expensive in storage and bandwidth, particularly for users on limited mobile data, so consider limiting video length. Store media privately and use expiring links, so that a copied link does not give access forever.
What moderation and safety controls do you need?
Any open conversation between users can be abused. Plan basic controls at launch: block user, report message or user, and an admin screen where your team can review reports and act. Rate-limit new accounts, to reduce spam.
For apps where strangers meet, such as dating, safety work is central. A product like the Hmm Dating app, with random matching and chat between users who have not met, needs blocking, reporting and review flows designed from the start. You can read more in the Hmm Dating case study and our dating app development guide. Automated filters for abusive words or images can help, but they make mistakes, so keep a human review path.
How do you scale chat from a few users to many?
A single server can handle the first users. As connections grow, you need to distribute them: several chat servers behind a load balancer, plus a shared layer such as a message broker or pub/sub system so a message reaches the right server holding the recipient's connection.
Other scaling steps include indexing message tables by conversation and time, archiving old data, and monitoring connection counts, delivery delays and error rates. Our guide on scaling an app covers these bottlenecks in general. Load-test before a launch campaign so a spike does not break messaging.
Conclusion: choose the simplest chat that fits
Pick the simplest approach that matches how important chat is to your product. Use a hosted service for supporting chat, build custom when chat is the product, and always design for offline users, media limits and safety.
Elevenmonk builds mobile apps and web products, including real-time features, from Mumbai. Share your idea through the project brief builder and we can discuss whether to buy or build chat for your app.
Frequently asked questions
How long does it take to add chat to an existing app?
With a hosted chat SDK, a basic one-to-one chat can often be integrated in days to a few weeks, depending on design and testing. A custom system with media, receipts, moderation and an admin panel usually takes longer, often a couple of months. Scope, platforms and existing backend quality are the main drivers.
Do I need WebSockets for chat?
Most real-time chat uses WebSockets because they allow instant two-way messaging. Hosted SDKs handle this for you. Polling can work for a very simple or low-volume feature, but it feels slower and wastes battery and bandwidth. Whatever you choose, add push notifications for offline users and a fetch-on-open fallback.
Can chat messages be end-to-end encrypted?
They can, but it is a significant design choice. It limits server-side moderation, search and some recovery features, and it needs careful key management. All chat should use encrypted connections in transit and secure storage. Decide on end-to-end encryption based on your users' needs, and take specialist security advice.
How should I handle abusive messages?
Give users block and report tools, review reports in an admin panel, and set clear community rules with actions such as warnings or suspension. Use automated filters as a first line, not the only line. For sensitive categories, such as dating, add extra safeguards and have trained people review serious reports.
Want help with this? Let’s talk.
Tell us what you are planning. A founder or senior engineer replies with honest next steps, from Mumbai, for clients across India and worldwide.
Prefer to share your idea in writing? Use the free project brief builder: answer a few questions and send the brief on WhatsApp in one tap.