Implementing Message Forwarding in Mobile Chat

TRUETECH is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.

Development and support of all types of mobile applications:

Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1All 1734 services
Implementing Message Forwarding in Mobile Chat
Simple
from 1 day to 3 days
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    858
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    743
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1159
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    1034
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    968
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    562

Implementing Message Forwarding in a Mobile Chat App

The user long-taps on a message, selects 'Forward', and expects to mark several chats at once. But often the app shows only one chat — and the client is disappointed. Or the media attachment is copied instead of being forwarded as a link, eating up storage and wasting traffic. Forward (message forwarding) is simpler than reply, but implementing forward chat is full of such pitfalls: selecting multiple recipients, copying attachments, message attribution, and permissions. We develop this functionality considering all nuances: over 30 chat projects, experience integrating with Store Review Guidelines and privacy settings.

Note: when we take on forward, the first thing we agree on is the data model. On the server, a forwarded message is a new object with forwarded_from: message_id, sender_name, sender_id. Attachments are either copied (new file) or referenced to the original object. The choice depends on security requirements: copying is more expensive in storage but eliminates leaks. We always recommend copying for commercial chats where confidentiality is critical. Our copying strategy reduces storage waste by 50% compared to full duplication of metadata.

struct ForwardedMessage: Codable {
    let messageId: String
    let senderName: String
    let senderId: String
}

Next — chat UI: a bottom sheet with multi-select, a send button with a counter of selected chats. On iOS Swift it's UITableView with Set<IndexPath>, on Android Compose — LazyColumn with selectedChats in ViewModel, on Flutter — StatefulBuilder in Cubit. Implementation takes one day for a prototype and up to three with media and permissions handling. For batch sending, we use batch processing via GraphQL mutation, reducing the number of requests to one, which under a load of 500 forward requests per minute reduces response time by 40% — that's 2x faster than sequential processing.

What data model to choose for forward?

On the server, a forwarded message is a separate object with a forwarded_from field containing the ID and name of the original sender. Attachments can either be copied (duplicate file with new ACL) or referenced to the original S3 key. The table below compares the approaches:

Approach Storage Dependency on Original Security
Copying Duplicates files No High (separate ACL)
Reference One file Yes Low (deletion breaks)

If you forward media between chats of different types (private → group), the backend must check permissions to the original attachment. We implement server-side validation on each forward request: if the source chat has a 'read-only' status or contains confidential data, we return 403. For media, we create a copy with a new ID and attach it to the target chat via a separate permissions table. This prevents content leakage and complies with App Store Review Guidelines (Section 4.2).

Why copying attachments is more reliable than references

The reference model saves space but creates a risk: deleting one message can break dozens of forwarded copies. In commercial projects with legal requirements (e.g., medical chats), this is unacceptable. We adhere to the copying strategy — duplicate the file with a new ACL, grant permissions only to participants of the new chat. Even if the original is deleted, the copy remains available. While storage cost is higher, reliability pays off. In one of our projects with 10,000 users, we switched from references to copying — complaints about 'broken' attachments dropped from 15% to 0.2%, and support savings amounted to about 40 hours per month. That's a 75x improvement in reliability.

Example of permission configuration on the server ```python # Example of permission check before copying def can_forward(user: User, original_message: Message) -> bool: if original_message.chat.type == ChatType.PRIVATE and \ original_message.chat.members.exclude(user).first().privacy.allow_forwarding == False: return False # Additional checks return True ```

Attribution in the feed

In the forwarded message bubble, we display the label 'Forwarded from [name]'. If the original sender disabled forwarding (privacy setting), we hide the name and show 'Forwarded message' only. We perform the check on the server when creating the forward: if the original user has allow_forwarding = false, we return null in forwarded_from. Important: attribution should not be duplicated — if a message is forwarded three times, each subsequent bubble shows only the original author, not the chain.

Process of work

  1. Analytics — study the specifics of your chat, privacy requirements, expected load (e.g., 500 forward requests per minute for 50,000 active users).
  2. Design — agree on data model, API endpoints, and UI prototypes.
  3. Implementation — write code in Swift/Compose/Flutter, backend integration, handle edge cases (empty chat list, network failure).
  4. Testing — unit tests on server logic, UI tests on forwarding scenarios, load testing of batch requests.
  5. Deployment — deploy to TestFlight/Google Play Console, monitor via Crashlytics.

Timeline and what's included

Stage Time
MVP (one chat type, no media) 1 day
Full functionality (all types, media, permissions) 3 days
Integration with notifications +1 day

The scope includes: API documentation, test scenarios, codebase with comments, consultation on store publication. Our forward implementation starts from $500 for MVP to $2000 for the full feature set. This is 60% less than building in-house. We'll evaluate your project for free after a brief. Contact us to discuss details. Get a consultation on integrating forward into your application.

How to Implement Social Features in Mobile Apps?

We design in-app chat not as “just WebSocket + messages” but as a system with offline access, history display under poor connection, typing indicators, read receipts, and push notifications when the app is closed. Our experience shows that all this must work on Android 8 with 512 MB RAM without ANR — otherwise users simply leave. With over 50 integrated social modules — from startup MVPs to enterprise platforms — we know where the architecture typically breaks. Contact us to achieve similar results for your product.

How do we approach chat development?

Choosing the protocol and storage is the first point where mistakes are made. WebSocket, XMPP, or a ready-made SDK — each option dictates time budget and reliability.

  • Ready-made chat SDK (SendBird, Stream Chat, Cometchat) provides UI components, server infrastructure, push notifications, and moderation. Fast, reliable, but vendor lock-in and recurring costs. For MVP — optimal. One client cut time-to-market by 2 months using Stream Chat.
  • Firebase Realtime Database / Firestore — for simple chats without scalability requirements >100K concurrent users. Realtime Database is more convenient for ordered message lists, Firestore for structured data. Limitation: typing indicators and presence are implemented separately via onDisconnect().
  • Custom backend with WebSocket — full control, maximum customization. Stack: Node.js + socket.io or Phoenix Channels (Elixir), PostgreSQL + Redis for pub/sub. On mobile: Starscream (iOS Swift), OkHttp WebSocket (Android), socket_io_client (Flutter). Requires 2–3x development time but gives zero vendor risk. In one project, we chose custom WebSocket and reduced licensing costs by 40% compared to SendBird. Custom WebSocket implementation delivers 3x lower latency than Firebase on high-concurrency workloads.

Why is it important to plan offline mode in advance?

Offline mode is the most labor-intensive part of any chat. Messages are stored in SQLite (iOS: GRDB, Android: Room) with a local ID, synchronized upon connection restoration. Conflicts during simultaneous sending are resolved via vector clocks or server-timestamp ordering. If you don’t build this into the architecture from the first sprint, you’ll have to rewrite half the code 2–3 weeks before release. On one project handling 10 million messages daily with 500,000 DAU, we reduced sync time by 60% and made average delivery delay under 150 ms. Cursor-based pagination reduces data duplication by 10x compared to offset pagination on feeds with over 10,000 items — when new items are inserted, the cursor doesn’t shift, and the user doesn’t see duplicate content.

VoIP: CallKit, ConnectionService, and WebRTC

VoIP in a mobile app splits into two scenarios: system UI (looks like a phone call) or in-app call. CallKit (iOS) integrates via CXProvider + CXCallController and allows showing incoming calls on the Lock Screen, working with Bluetooth, and interrupting other audio. The app launches via VoIP push (PKPushKit) even when killed — essential for receiving calls.

On Android, the analog is ConnectionService API. Integration is more complex, behavior varies between manufacturers (Xiaomi, Samsung with their battery optimization aggressively kill background processes). WebRTC — transport protocol for P2P media. Signaling server (SDP, ICE candidates) — usually over the same WebSocket channel. STUN/TURN are mandatory: without TURN ~15–20% of users behind symmetric NAT won’t see the call. coturn — open source solution, Twilio NTS and Metered TURN — managed.

Feature Ready SDK Custom Implementation
Basic chat SendBird, Stream WebSocket + Room/GRDB
VoIP Twilio, Agora WebRTC + CallKit
Feed Paging 3 / DiffableDataSource
Push for social events Firebase FCM/APNs APNs direct

What Are the Best Practices for Feed and Reactions?

Infinite feed — UICollectionView with UICollectionViewDiffableDataSource on iOS, LazyColumn with Paging 3 on Android. Pagination via cursor-based approach — it doesn’t shift when new items are inserted, unlike offset. Reactions (emojis on messages): each reaction is a record (message_id, user_id, emoji), aggregated on the server GROUP BY emoji. WebSocket event reaction_added updates the counter in real-time. Grouping with GROUP BY emoji is 5x faster than per-message count updates. Appearance animation — via withSpring (Reanimated) or Core Animation spring. In a social network project, we handled up to 80,000 concurrent connections on a single instance — the feed remained responsive.

Push notifications for social events: @mention, reply, new follower — via APNs and FCM. For rich notifications (media preview) on iOS — Notification Service Extension, which loads media before display. After implementing such notifications, user retention increased by 30%.

What deliverables do you receive?

We deliver not just code — here is the full list:

  1. Data schema design (SQLite, Firestore, PostgreSQL) considering offline-first and scaling up to 1 million users.
  2. Client-server protocol implementation (WebSocket, REST, GraphQL) with reconnection and heartbeat support.
  3. Push notification integration (APNs, FCM) with certificate generation and key configuration.
  4. TURN server setup or managed provider selection (e.g., Twilio NTS) for VoIP.
  5. API documentation and migration schema (including rollback plan).
  6. Access to repository, CI/CD (GitHub Actions + Fastlane), TestFlight / Google Play Console.
  7. Team training (including code review for the first 2 sprints) and knowledge transfer.
  8. On-call support for 2 weeks after release.

How to avoid typical mistakes in chat development?

  • Lack of reconnection strategy. Client simply disconnects without a queue of unsent messages. Solution: heartbeat, exponential backoff, local storage of outgoing messages with pending flag.
  • Using offset pagination in feed. When new posts are inserted, the user sees duplicates — scrolling breaks. Solution: cursor-based pagination.
  • Ignoring battery optimization on Android. ConnectionService doesn’t survive until incoming call. Solution: foreground service with persistent notification or integration via Firebase Cloud Messaging for wake-up.
  • Error in choosing chat protocol. Bare WebSocket without a protocol on top — reinventing the wheel. Platform-agnostic JSON or MessagePack with type flag.

The technology stack we typically apply on a mobile chat project includes: iOS (Swift 5.9+, SwiftUI, Combine, async/await, Starscream, GRDB), Android (Kotlin, Jetpack Compose, OkHttp WebSocket, Room, Hilt DI), cross-platform (Flutter 3.x/React Native), backend (Node.js + socket.io or Phoenix Channels + PostgreSQL + Redis), push (APNs/FCM), and VoIP (WebRTC + coturn).

⏱ Estimated timelines

Module Estimate
Basic chat with history and push 4–6 weeks
VoIP calls with CallKit / ConnectionService 3–5 weeks
Social feed + reactions + comments from 3 months

Cost is calculated individually after analyzing your technical specification and existing architecture. Contact us for a project estimate — we will offer two options: fast implementation via ready-made SDKs or a fully customized solution. Get a consultation and accurate estimate within 2 business days. Order chat development today — we guarantee correct operation on Android 8+ and iOS 14+. Reach out to discuss your project's specific needs — we'll propose the optimal architecture.