Skip to content
Systems

Omnidesk BD: Realtime Whiteboard Canvas Architecture

Technical observations on designing a sub-16ms double-buffered HTML5 canvas engine and conflict-free whiteboard synchronization for Bangladeshi students.

Remix into Workplace Studio:

What Was I Trying to Do?

In rural and divisional schools in Bangladesh, online learning platforms often fail due to unstable 3G/4G bandwidth and low-end Android tablets. I wanted to design Omnidesk BD as a lightweight, zero-bloat collaborative learning environment where interactive math, geometry, and lecture slides render smoothly at 60 FPS even on budget devices.

The Canvas Architecture

User Touch/Pen Event ➔ Coordinate Smoothing (Catmull-Rom) ➔ Offscreen Canvas Buffer ➔ Direct Viewport Blit ➔ Micro-Delta Broadcast (WebSockets)
  1. Double-Buffering & Offscreen Canvas:
    • Instead of rendering vectors directly to the visible DOM, all pen strokes are drawn to an in-memory OffscreenCanvas.
    • The main rendering loop simply executes ctx.drawImage(offscreenBuffer, 0, 0) on requestAnimationFrame, eliminating layout thrashing.
  2. Bezier Path Smoothing:
    • Raw pointer events arrive at irregular intervals. I implemented quadratic Bezier curve interpolation between consecutive sample points to avoid jagged polygonal strokes.
  3. Bandwidth Optimization:
    • Instead of broadcasting raw mouse coordinates at 60Hz, pen strokes are bundled into compressed differential coordinate packets (dx, dy relative to stroke origin).

Key Highlights & Performance

  • Touch-to-Render Latency: Achieved sub-16ms drawing feedback (under 1 frame drop at 60Hz).
  • Network Payload: Full session delta broadcast required less than 4.2 KB per active drawing minute.
  • Local Fallback: Offline caching via IndexedDB allows full lecture note preservation when internet connectivity drops.

What I Learned

Vector memory will leak quickly in long drawing sessions if past strokes are kept as individual object instances. Flattening completed strokes onto a rasterized background layer after 15 seconds of inactivity reduced memory usage from 420MB down to a stable 48MB.

CanvasNext.jsWebSocketsOmnideskEdTech
Md Sabbirul Islam Khan

Md Sabbirul Islam Khan

Written by THE SABBiR