HomeCase studiesCross-Platform Online Doctor Consultation Platform with Adaptive...

Case study · Riyadh, Saudi Arabia

Cross-Platform Online Doctor Consultation Platform with Adaptive WebRTC Media Routing and Virtual Triage

On-Demand Telemedicine & Virtual Care

Patients seeking timely medical consultations often abandon fragmented telehealth portals that fail on variable mobile connections or disconnect video calls from clinical charting and prescriptions. We engineered a cross-platform online doctor consultation system using Flutter for mobile patients, a web portal for clinicians, Node.js signaling and orchestration services, and WebRTC selective forwarding media infrastructure. The platform unifies bilingual symptom intake, live virtual waiting rooms, resilient HD video visits, and signed digital prescriptions in one auditable clinical workflow.

Industry
On-Demand Telemedicine & Virtual Care
Solution
A cross-platform telemedicine ecosystem combining Flutter patient apps, a clinician web console, Node.js real-time signaling, and WebRTC media routing for live video visits, triage, and e-prescribing.
Platforms
Cross-platform · Web & API
Stack
Flutter · Node.js · WebRTC · TypeScript · PostgreSQL · Redis
Location
Riyadh, Saudi Arabia · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Riyadh, Saudi Arabia. Names withheld by agreement.

Project Overview

Virtual care only works when a patient moving from symptom intake to a live physician conversation experiences zero technical friction. Many early telehealth rollouts stitched together generic consumer video links with separate booking forms, leaving doctors without patient history during the call and forcing patients to rejoin broken rooms whenever cellular reception fluctuated.

Working around regional clinical delivery requirements in Riyadh, we built an end-to-end online doctor consultation platform spanning Flutter mobile applications on iOS and Android, a browser-based physician console, Node.js real-time services, and WebRTC media infrastructure. Patients select specialties, complete structured bilingual triage, wait in a live virtual queue, conduct encrypted video consultations, and receive verifiable digital prescriptions inside a single continuous experience.

Telemedicine Friction Points

Building reliable remote consultations across heterogeneous home broadband and cellular networks surfaced four recurring engineering obstacles:

  • Carrier NAT and firewall drops: Direct peer-to-peer WebRTC handshakes routinely failed behind restrictive mobile carrier gateways, causing black-screen calls right as clinicians joined.
  • Volatile bandwidth on mobile devices: Fixed-resolution video streams froze completely when patients moved between Wi-Fi and LTE, interrupting clinical assessments.
  • Disjointed waiting room state: Naive database polling left patients unsure of their queue position and failed to reassign rooms promptly when a specialist ran long or went offline.
  • Split charting and video windows: Physicians toggling between standalone video apps and separate EHR tabs lost eye contact and missed uploaded lab attachments during short consult windows.

Architectural Strategy

We decoupled the control and signaling plane from the real-time media plane. Node.js and TypeScript manage authenticated consultation lifecycles, Redis-backed waiting room queues, and Socket.IO WebRTC signaling, while dedicated Selective Forwarding Unit (SFU) media servers handle DTLS-SRTP media packets and adaptive simulcast streams.

Inside Flutter, native platform channels manage camera permissions, CallKit/ConnectionService incoming-call screens, and audio routing (Bluetooth headsets vs speakerphone) so virtual visits behave with the reliability of native telephony rather than fragile embedded webviews.

Core Capabilities

  • Bilingual Smart Intake & Triage: Captures chief complaints, vital measurements, allergies, and encrypted lab photo attachments in full Arabic RTL and English LTR layouts before the call begins.
  • Live Virtual Waiting Room: Uses Redis-backed priority queues to display real-time queue placement, accommodate urgent triage escalations, and notify patients via push alerts moments before entry.
  • Adaptive WebRTC Video & Audio Fallback: Employs simulcast video layers and TURN/TCP fallback relays so consultations hold steady across fluctuating mobile data connections.
  • Unified Clinician Charting Workspace: Presents intake history, past visit timelines, live video, structured SOAP note templates, and diagnostic ordering side by side.
  • Signed E-Prescriptions & Follow-Up Orders: Generates tamper-evident digital prescriptions and lab referrals routed directly to patient wallets and partner pharmacy verification endpoints.

Technical Architecture

Patients authenticate via mobile OTP and initiate either an on-demand triage request or a scheduled specialist slot. Node.js places the encounter in a Redis queue and allocates a scoped room token. When the clinician accepts the patient, Socket.IO orchestrates SDP offers and ICE negotiation toward the nearest SFU node, while consultation state transitions and clinical notes persist durably to PostgreSQL.

Flow: Flutter / Web Client → Node.js API & Socket.IO Signaling → Redis Waiting Queue → WebRTC SFU + TURN Media Plane → Clinician SOAP & E-Prescription Commit → PostgreSQL + Signed Artifact Store

Keeping media forwarding completely outside Node.js ensures signaling servers stay lean and horizontally scalable across multiple cluster workers synchronized via Redis Pub/Sub.

Technology Stack

Category Technology detail
Patient Mobile Apps Flutter codebase delivering native iOS and Android experiences with full RTL/LTR support
Signaling & API Tier Node.js with TypeScript orchestrating appointments, triage states, and consultation lifecycles
Real-Time Media Plane WebRTC SFU media routers with TURN/STUN relays supporting adaptive bitrate video
WebSocket Signaling Socket.IO over Redis Pub/Sub coordinating room joins, ICE candidates, and queue events
Clinical & Billing Store PostgreSQL persisting encrypted patient intake forms, SOAP notes, and e-prescriptions
Queue & Presence Engine Redis sorted sets managing live triage queues, doctor availability, and session heartbeats
Clinician Web Console Browser-based video consultation workspace with side-by-side patient chart and prescribing
Artifact Storage Encrypted object storage holding lab uploads, diagnostic images, and signed PDF prescriptions
Push & SMS Notifications APNs, FCM, and regional SMS gateways delivering queue-turn alerts and OTP verification

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Peer-to-peer WebRTC breaks on multi-party interpreter calls and strict NATs Standardized on an SFU + TURN relay topology; adds modest server bandwidth overhead in exchange for predictable traversal and smooth multi-participant joins.
Mid-call network switches between Wi-Fi and LTE drop standard WebSockets Implemented Socket.IO heartbeat recovery paired with automated WebRTC ICE restarts in Flutter, preserving room identity without forcing the patient to re-enter the queue.
Clinicians need instant queue updates without hammering PostgreSQL Modeled active waiting rooms and doctor presence inside Redis sorted sets, syncing only durable state transitions (entered, started, completed) back to PostgreSQL.
Embedded HTML5 WebViews on mobile suffer inconsistent microphone and Bluetooth routing Built native Flutter WebRTC bindings integrated with iOS CallKit and Android audio focus APIs, increasing native platform testing scope while eliminating audio glitches.

Clinical Privacy & Session Integrity

Virtual healthcare consultations carry sensitive personal health disclosures, identity documents, and clinical imagery that demand regional data residency and end-to-end transport protection. All consultation signaling runs over TLS, and WebRTC audio/video streams use mandatory DTLS-SRTP encryption so media packets remain protected across public wireless networks.

Room join tokens are short-lived, bound strictly to the authenticated patient, assigned physician, and an optionally invited interpreter or caregiver. Uploaded laboratory photos and prescription PDFs never reside in public object buckets; clients retrieve them exclusively via audited, time-limited pre-signed URLs after backend encounter ownership verification. Complete clinical audit logs track every chart view, consultation join/leave timestamp, and prescription signature inside PostgreSQL.

Network Resilience & Media Scale

Telemedicine demand surges sharply during evening hours and seasonal respiratory waves, when hundreds of concurrent consultations open simultaneously across mobile devices with uneven uplink speeds. To keep video sessions clear under congestion, the WebRTC SFU subscribes publishers to multiple simulcast encodings and dynamically downscales incoming video tiers for bandwidth-constrained participants while prioritizing audio packet continuity.

On the orchestration layer, stateless Node.js signaling instances scale horizontally behind sticky-free load balancing using Redis Pub/Sub adapters, allowing any node to relay room events reliably. Automated stale-session sweepers detect orphaned rooms from dead batteries or dropped connections and gracefully pause billing timers until the patient reconnects within the grace window.

Operational Outcomes

Unifying mobile triage, resilient WebRTC streaming, and structured digital prescribing inside one architecture transformed virtual care delivery for both patients and clinicians:

  • Dependable mobile consultation quality: SFU routing and automated ICE recovery keep doctor-patient visits connected across everyday cellular handoffs and low-bandwidth connections.
  • Streamlined specialist throughput: Real-time virtual waiting rooms and pre-populated bilingual intake summaries allow clinicians to focus consultation minutes on diagnosis rather than manual data gathering.
  • Continuous care handoffs: Integrated SOAP charting, attachment viewing, and verifiable e-prescriptions close the loop between remote assessment and pharmacy fulfillment.
  • Unified cross-platform maintenance: Sharing business rules across a single Flutter mobile codebase and TypeScript backend accelerates clinical feature releases across iOS, Android, and web.

01 — Questions

asked about this kind of project

Why route telemedicine video through a WebRTC SFU instead of direct peer-to-peer connections?

Peer-to-peer WebRTC frequently stalls behind strict carrier NATs and makes three-way calls with an interpreter or caregiver unreliable. A Selective Forwarding Unit (SFU) paired with regional TURN relays stabilizes traversal over cellular networks, enables simulcast bandwidth adaptation, and simplifies controlled supervisor or translator joins.

How does the Flutter app behave when a patient switches from Wi-Fi to 4G mid-consultation?

Socket.IO automatically renegotiates signaling over the new network interface while WebRTC initiates an ICE restart to rebind media transport without tearing down the clinical session room. If video packets still degrade severely, the SFU steps down video layers or drops cleanly to audio-first mode while keeping consultation chat active.

How are Node.js event loops protected from blocking during high consultation volume?

Node.js handles lightweight REST APIs, room state machines, and WebRTC SDP signaling while delegating all media packet forwarding to native C++/Rust SFU workers and offloading PDF prescription rendering to isolated background worker queues.

How did you handle bilingual Arabic and English clinical workflows in Flutter?

Every layout widget, calendar picker, and prescription viewer respects directional insets (`Directionality` and logical alignment) rather than hardcoded left/right margins. Clinical dropdowns store canonical medical codes internally while rendering localized Arabic or English labels dynamically.

How are electronic prescriptions protected against tampering after a consultation ends?

Once a physician signs a consultation note and medication list, the backend generates a hashed, digitally signed prescription payload linked to the encounter ID. Pharmacies verify dispensing eligibility through a single-use token API that prevents duplicate fulfillment.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.