Skip to content

Research: Offline messaging

barisoksuz edited this page Feb 24, 2026 · 7 revisions

Offline Messaging & Hybrid Architecture Research Summary

1. High-Level Architecture

The system will use a hybrid transport model:

Transport A --- Online (Server-Based)

  • Django backend (We can discuss about it but I think django is ok)
  • PostgreSQL database (we can decide what to use later)
  • REST APIs: DRF (if we use django, django rest framework will be used)
  • FCM push notifications (I plan to use it for some sort of offline sync)

Transport B --- Offline (Mesh-Based)

  • Android-only (Kotlin)
  • BLE for discovery
  • Wi-Fi Direct for high-speed sync
  • Store-Carry-Forward (Delay Tolerant Networking model)
  • Foreground service when mesh mode is enabled

2. Offline Mesh Design

2.1 Technology Stack (Android)

  • Language: Kotlin
  • BLE: Device discovery
  • Wi-Fi Direct: Local LAN creation for data transfer
  • Local DB: Room (SQLite)

Kotlin (or java) is mandatory for the offline mesh because Android radio APIs (BLE, Wi-Fi Direct, foreground services) require native access.

3. Mesh Communication Model

We use a Delay Tolerant Network (DTN) approach:

  • Devices store messages locally
  • When devices meet, they exchange message inventories
  • Missing messages are transferred
  • Messages propagate multi-hop over time

This allows offline users to receive posts indirectly via other devices.

4. Online vs Offline Posting Sections

Two sections per hub: (Actually we do not have to have two different feeds but for now this is the best idea that I have so we can discuss together in a meeting or sth like that.)

Online Feed

  • Server-first delivery
  • Global reach

Offline Feed

  • Mesh-first delivery (even if online) (an online user may want to send messages to the people that are offline, so he/she posts here and mesh communication starts)
  • Intended for local emergency broadcast

This gives clear user expectations and avoids confusion.

5. Delivery Rules

(The followin makes sense to me because a panicked user may post to online feed instead of offline and that message should not vanish)

If Internet Available:

  • Online post → send to server
  • Offline post → send via mesh + server sync when have connection

If Internet Unavailable:

  • All posts → mesh
  • Mark for later server sync

6. Battery Strategy

  • Mesh only runs when toggle ON
  • Foreground service required
  • Duty-cycle scanning (e.g., 15s scan / 45--120s sleep)
  • Short Wi-Fi Direct sessions (connect → sync → disconnect)

7. Final Conclusions

  1. Kotlin is mandatory for Android mesh layer.
  2. A user-controlled Mesh Mode is necessary for battery control.
  3. Two feeds (Online + Offline) improve clarity and reliability.
  4. Store-Carry-Forward DTN model is the correct offline strategy.

Clone this wiki locally