Yassir Chat SDK
Designed and built a multi-tenant chat & calling SDK — powering in-app messaging and voice/video across 6+ Yassir products with offline-first sync and resilient real-time connections.
6+
Yassir product verticals integrated via one SDK
Offline-first
Zero message loss on intermittent connectivity
Overview
At Yassir, I designed and built the Chat SDK — a standalone Android library that gives any product in the Yassir ecosystem in-app messaging and voice/video calling through a small, well-defined public API (ChatSDK, ChatClient, ChatConfig.Builder). It is integrated into 6+ verticals across the platform, each with its own branding, feature flags, and conversation contexts, all backed by one shared engine.
The core engineering challenge was making a single SDK feel instant and reliable everywhere it ships — on flaky mobile networks, across app backgrounding and reconnects, and under the load of multiple host apps using it concurrently. That meant building an offline-first sync engine, a resilient WebSocket layer with coordinated auth refresh, and a calling stack that bridges real-time signaling with media transport — all wrapped in a public API simple enough for other teams to integrate in an afternoon.
As part of the Platform & Infrastructure team, I also drove the SDK’s rollout — working directly with each consuming team to integrate, configure, and validate the SDK in their app, turning a single internal library into the shared messaging and calling layer for the whole company.
Architecture
SDK Architecture & Multi-Tenant Design
One engine, many host apps — a small public API hiding a large internal system
The SDK is structured as a clear boundary between a small public surface (ChatSDK entry point, ChatClient for runtime operations, and a ChatConfig.Builder for per-host configuration) and a much larger internal implementation. Each host app configures its own theming, feature toggles, and identity context, while sharing the same sync, networking, and persistence layers underneath — so improvements to the core benefit every integrating product at once.
- ● Builder-pattern configuration (ChatConfig.Builder) lets each host app opt into features and branding without touching internal code
- ● Dependency injection (Koin) isolates the SDK’s object graph from the host app’s, avoiding collisions across 6+ integrations
- ● Clean Architecture layering (data / domain / presentation) keeps the public API stable while internals evolve independently
- ● Versioned as an internal library so host apps can upgrade independently and roll back if needed
Main chat inbox
Offline-First Sync Engine
Cursor-based incremental sync that keeps every device consistent after any disconnect
The SyncEngine is the core of the SDK’s reliability story. Every conversation has a local-first source of truth in Room, and a sync layer reconciles it with the server using different strategies depending on how far out of date the client is — from a lightweight incremental catch-up to a full resync after a long disconnect.
- ● Three sync strategies (none / incremental / full) chosen automatically based on a server-provided cursor, avoiding unnecessary full reloads
- ● A persistent outbound queue retries failed sends with exponential backoff (1s → 2s → 4s → 8s, capped at 30s), guaranteeing no message is silently dropped
- ● Background sync via WorkManager keeps conversations up to date even when the app is not in the foreground
- ● Optimistic local writes with reconciliation — the UI updates instantly and converges with the server state once sync completes
Start voice recording
Resilient Connection & Auth
A WebSocket layer that survives flaky networks and coordinates token refresh across every consumer
Real-time messaging runs over Phoenix channels on a single persistent WebSocket. I built the reconnection and authentication logic to handle the realities of mobile networks — tunnels, app switching, and expiring tokens — without ever leaving the SDK in an inconsistent state, even when multiple host app screens are using it at once.
- ● Exponential backoff reconnection (1s → 30s) with foreground/background awareness to avoid reconnect storms when the app is backgrounded
- ● Mutex-protected token refresh with double-checked locking — concurrent requests from multiple screens trigger only one refresh, with all callers sharing the result
- ● Atomic cache updates across the token manager and socket layer prevent races between an expiring token and a reconnect attempt
- ● Duplicate-connection guards and heartbeat monitoring keep exactly one healthy socket per session
Message sending status
Voice & Video Calling
Phoenix-signaled WebRTC calls via LiveKit, integrated into the same SDK surface
The SDK extends beyond messaging into voice and video calls, using a hybrid architecture: call signaling (ringing, accept/decline, call state) travels over the existing Phoenix channel, while audio/video media is handled by LiveKit’s WebRTC stack. This reuses the SDK’s connection and auth layer for signaling instead of standing up a second real-time system.
- ● Call lifecycle (ring, connect, end, timeout) driven by Phoenix events, decoupled from the media transport
- ● LiveKit integration for WebRTC audio/video, with a 90-second timeout guarding unanswered calls
- ● Shared auth and reconnection logic with the chat layer — no duplicated token or socket management for calls
Impact
6+
Yassir product verticals integrated via one SDK
Offline-first
Zero message loss on intermittent connectivity
A single, well-tested SDK replaced the need for each product team to build their own chat and calling stack — giving every Yassir vertical instant messaging and WebRTC calling with consistent reliability, while the core team owns and improves one shared engine.
Tech Stack
Next
ARBIN Rider & Driver