An interactive dual-panel protocol visualization dashboard upgraded with real network communication powered by Python + FastAPI, raw TCP socket communication, real DNS resolution, real HTTP/HTTPS requests, real HLS media streaming, and real-time Server-Sent Events (SSE).
Important
Academic Integrity & Transparency Notice: This project uses real network communication for all protocol demonstrations:
- Browsing: Performs real DNS resolution and real HTTP/HTTPS requests with actual headers and status codes.
- Mail: Performs real TCP socket communication using Python's
socketmodule against a local test SMTP server (127.0.0.1:2525). It does not deliver email externally. - Streaming: Performs real HTTP requests to retrieve HLS master/rendition playlists and binary MPEG-TS segments.
- Every event is explicitly labeled as
REAL NETWORK EVENTorSIMULATED EVENT(when falling back if the backend or SMTP server is unavailable).
The system maintains a strict separation of concerns across a dual-panel interface:
Browser (React + Vite, Port 5173)
├── LEFT PANEL: Activity Panel (Browsing, Mail, Streaming forms + Activity Log)
└── RIGHT PANEL: Protocol Inspector (Timeline, Playback controls, Message details)
↕ (Server-Sent Events / SSE at /api/...)
FastAPI Backend (Python 3.10+, Port 8000)
├── /api/browse/stream ─── Real DNS query via dnspython + Real HTTP/HTTPS via httpx
├── /api/mail/send ─── Real TCP socket (RFC 5321) to 127.0.0.1:2525
├── /api/stream/start ─── Real HTTP requests fetching HLS master, variant & segments
└── /api/stream/media/ ─── HLS media endpoints serving real playlists and TS chunks
↕
Local SMTP Test Server (Python AsyncIO, Port 2525)
└── Safe RFC 5321 test server — logs all commands, sends real SMTP replies, never delivers externally
- Python: 3.10 or higher
- Node.js: 18 or higher
- npm: 9 or higher
pip install -r requirements.txt(Dependencies: fastapi, uvicorn, httpx, dnspython)
npm installIn your first terminal, start the safe local SMTP test server:
python backend/smtp_server.pyOutput:
============================================================
Protocol Visualizer — Local SMTP Test Server
Listening on 127.0.0.1:2525
This server does NOT deliver emails externally.
Press Ctrl+C to stop.
============================================================
In your second terminal, start the FastAPI backend:
python -m backend.mainOr with uvicorn directly:
uvicorn backend.main:app --port 8000 --reloadThe backend will be live at http://127.0.0.1:8000.
In your third terminal, start Vite:
npm run devOpen http://localhost:5173 in your browser.
The top navbar will show:
REAL NETWORK MODE(green badge)Protocol communication uses real network requests/sockets.
(If the backend is not running, the application automatically shows SIMULATION FALLBACK and falls back gracefully).
- Select the Browsing tab on the Left Panel.
- Enter any valid target URL (e.g.
https://example.comorhttps://httpbin.org/get). - Click Visit Page →.
- Observe the Right Panel:
- DNS Query & Response: Actual resolved IP address, actual query time in milliseconds, transaction ID, and TTL.
- HTTP Request & Response: Real HTTP method, headers, response status code (e.g.
200 OK), server name, and snippet of response body. - For HTTPS URLs, transport is tagged as
HTTPS/TLS (Encrypted)without fabricating fake handshake packets. - If an invalid domain is entered, the real DNS error is displayed.
- Select the Mail tab on the Left Panel.
- Enter recipient (e.g.
user@example.com), subject, and message body. - Click Send Email →.
- Observe the conversation over the real TCP connection (
127.0.0.1:2525):220 Server greetingEHLO client.local250 EHLO capabilitiesMAIL FROM:<sender@protocol-visualizer.local>250 Sender acceptedRCPT TO:<user@example.com>250 Recipient acceptedDATA354 Ready for message[Message: "..."](Contains your exact recipient, subject, and body)250 Message accepted (queue ID)QUIT221 Connection closing
- Activity log records:
"SMTP connection established""SMTP conversation completed"(never falsely claims "Email delivered")
- Error Case: Stop the SMTP server (
Ctrl+Cin Terminal 1) and click Send Email again. The visualizer clearly shows:Cannot connect to SMTP test server at 127.0.0.1:2525with instructions to start it.
- Select the Streaming tab on the Left Panel.
- Choose a stream quality (
360p,720p,1080p) and segment count (3, 6, or 10). - Click Start Stream →.
- The backend and frontend execute real HTTP requests:
- Real GET to
/api/stream/media/master.m3u8 - Real GET to
/api/stream/media/{quality}/playlist.m3u8 - Real GET requests for each individual segment (
segment0.ts,segment1.ts, etc.) - Real HTTP
200 OKstatus codes,video/mp2tcontent-types, and byte sizes.
- Real GET to
Run the backend test suite:
python -m pytest -v -s tests/This verifies:
- Real DNS resolution against live public hosts and error handling
- Direct IP literal bypass
- Real HTTP GET requests with actual headers and content
- Real TCP SMTP socket conversation with RFC 5321 server
- Connection refused error handling
- HLS media generation and TS packet structure
- FastAPI SSE and media endpoints
Protocol-Visualizer/
├── backend/
│ ├── main.py # FastAPI application & SSE endpoints
│ ├── smtp_server.py # Safe local RFC 5321 SMTP test server
│ └── networking/
│ ├── dns_client.py # Real DNS resolution via dnspython + socket fallback
│ ├── http_client.py # Real HTTP/HTTPS requests via httpx
│ ├── smtp_client.py # Real raw TCP socket SMTP conversation
│ ├── stream_service.py # Real HLS playlist & TS segment generation/fetching
│ └── events.py # ProtocolEvent model & SSE stream formatters
├── src/
│ ├── App.jsx # Top navbar with real network mode status badge
│ ├── context/
│ │ └── SessionContext.jsx # Dual-panel synchronization with SSE streaming support
│ ├── hooks/
│ │ └── usePlayback.js # Interactive playback engine (Play/Pause/Step/Replay/Speed)
│ ├── components/
│ │ ├── layout/
│ │ │ └── DashboardLayout.jsx # Exactly two main panels (Left Activity, Right Inspector)
│ │ ├── activity/
│ │ │ ├── ActivityPanel.jsx # Left panel container
│ │ │ ├── ActivityTabs.jsx # Browsing / Mail / Streaming switcher
│ │ │ ├── BrowsingForm.jsx # Real DNS/HTTP visit form with SSE
│ │ │ ├── MailForm.jsx # Real TCP SMTP email form with SSE
│ │ │ ├── StreamingPlayer.jsx # Real HLS streaming player with SSE
│ │ │ └── ActivityLog.jsx # Timestamped real network activity log
│ │ └── protocol/
│ │ ├── ProtocolPanel.jsx # Right panel container
│ │ ├── Timeline.jsx # Step sequence with REAL vs SIM tags
│ │ ├── MessageCard.jsx # Message inspector with REAL NETWORK EVENT badge
│ │ └── PlaybackControls.jsx# Transport controls & speed selector
│ └── styles/
│ └── index.css # Professional dark neutral theme
├── tests/
│ ├── test_backend.py # Networking integration tests
│ └── test_api.py # FastAPI endpoints tests
├── package.json
├── requirements.txt
├── vite.config.js # Proxy configuration (/api -> localhost:8000)
└── README.md
- Developer: Subham Pathak
- GitHub: https://github.com/itzsubham2006
- Portfolio: https://www.subhamm.me
- Repository: https://github.com/itzsubham2006/Protocol-Visualizer
MIT License