← Back to Selected Work
Full Stack / FrontendYEAR: 2025ROLE: Full Stack Engineer

Real-Time WebSocket Canvas

A collaborative drawing whiteboard application built with WebSockets and HTML5 Canvas allowing real-time multi-user cursor sync and room sessions.

// TECHNOLOGIES USED
TypeScriptNext.jsReactNode.jsWebSocketsHTML5 CanvasTailwind CSS

Project Visual Preview

ws://canvas-cluster/room-809
3 PEERS CONNECTED
Protocol: WebSocketsEngine: HTML5 Canvas
// 01. OVERVIEW

Project Overview

An event-driven collaborative canvas built to explore WebSocket binary and JSON message streaming without relying on heavy third-party SaaS services.

// 02. PROBLEM & SOLUTION
The Problem

Real-time canvas drawing requires broadcasting coordinates with minimal network bandwidth usage to prevent stutter across concurrent clients.

The Solution

Designed a lightweight WebSocket message protocol that batches drawing path points before broadcasting to active room subscribers.

// 03. SYSTEM ARCHITECTURE

System Design & Data Flow

// SYSTEM ARCHITECTURE FLOWHTML/CSS Rendered Flow
LAYER 01

User Canvas Client (React)

LAYER 02

WebSocket Client Connection

LAYER 03

Node.js WSS Server (Room Hub)

LAYER 04

Broadcast Broadcast Pipeline

Architectural Highlights
  • HTML5 Canvas rendering engine with double-buffering logic
  • Node.js WebSocket server managing active room subscriptions
  • Next.js client interface with responsive toolbar and color pickers
// 04. KEY FEATURES

Core Functionality & Capabilities

Low-latency vector path broadcasting over WebSockets
Room-based drawing session isolation
Undo/Redo drawing history stack
Responsive HTML5 Canvas rendering for mobile and desktop screens
// 05. TECHNICAL CHALLENGES

Obstacles & Engineering Solutions

Challenge #1: Synchronizing state when new users join an active drawing session.
Solution: Implemented an in-memory session canvas snapshot generator on the server that broadcasts current state upon client handshake.
// 06. ENGINEERING DECISIONS

Trade-offs & Design Rationale

  • Selected native WebSockets over heavy abstractions to understand low-level connection lifecycles and heartbeat reconnect logic
// 07. LEARNINGS & TAKEAWAYS

Personal Growth & Technical Insights

Gained hands-on experience with real-time bi-directional network communication protocols