Course contentsShow
← Web Development
Lesson 2206 of 2,98240. Browser DevTools Deep DiveFree lesson

WebSocket and EventSource Inspection

Monitor real-time connections, view messages sent and received, and debug WebSocket or Server-Sent Events.

WebSocket and EventSource Inspection

What you'll learn: How to monitor and debug real-time, persistent connections in your browser's DevTools.

Unlike traditional HTTP requests that complete and close, WebSocket and EventSource (Server-Sent Events) connections stay open to enable real-time, bidirectional (WebSocket) or server-to-client (EventSource) communication. Think of them like an open phone line instead of passing notes back and forth.

Why Inspect Real-Time Connections?

When your application uses chat features, live notifications, or streaming data, these persistent connections power the experience. But debugging them differs from regular requests—you need to see messages flowing over time on the same connection.

Finding Real-Time Connections

In the Network Panel, WebSocket connections appear with a WS or WSS protocol badge, while EventSource connections show as eventsource type. You can filter by clicking "WS" in the filter toolbar to isolate these connections from regular HTTP traffic.

Inspecting Messages

Click on a WebSocket or EventSource connection to open its detail view. You'll see tabs including:

  • Messages: Every message sent and received, timestamped in chronological order
  • Preview/Response: The actual message content (often JSON)
  • Timing: Connection establishment breakdown

The Messages tab shows green (outgoing) and white (incoming) entries, letting you trace the conversation flow. For EventSource, you'll only see incoming messages since it's one-way communication.

Practical Debugging

You can verify your application sends correct message formats, check server responses match expectations, and identify timing issues—like messages arriving out of order or connections dropping unexpectedly.

Key Takeaway: Browser DevTools let you inspect persistent WebSocket and EventSource connections through the Network Panel, revealing the full message history and timing of real-time communications.