Skip to content
GDPR compliant. Hosted in DE.
14-day free trial →
Browser MonitoringRealtimeSynthetic Checks
Monitoring 12 min read 22 Jun 2026

Monitoring WebSocket and Realtime Endpoints in 2026

Realtime features need more than a ping: how to reliably monitor the WebSocket handshake, ping/pong, message round-trip, and reconnect for live features.

X

XICTRAQ Team

XICTRAQ

WebSocketRealtimeBrowser-MonitoringSSEMonitoring
41%
of large enterprises: USD 1-5M loss per hour of downtime (ITIC 2024)
5,600 USD
cost of unplanned outages per minute (Gartner)
125 bytes
max payload of a ping/pong frame (RFC 6455)
Monitoring the WebSocket lifecyclewss://live.your-domain.com/socketRFC 64551Handshake: HTTP 101 Switching ProtocolsUpgrade header + origin check118 ms2OPEN: connection establishedreadyState 1 - bidirectional channelOK3Ping 0x9 -> Pong 0xAHeartbeat every 30 s - zombie detection41 ms4Message round-trip (echo)send -> onmessage - end-to-end latency63 msConnection dropped (code 1006)Pong timeout - reconnect triggeredAlert: email, Slack, TelegramDOWNBrowser API gives JS no access to ping/pong frames(RFC 6455 - automatic pong reply)Realtime healthMedian message RTT63 msp95 148 ms - target under 250 msHandshake successlast 24 h99.7%!Reconnectsauto, backoff active3Pong rateheartbeat 30 s100%RTT history (12 h)41% of large enterprises put a single hour of downtime at USD 1-5M (ITIC 2024) - XICTRAQ browser and realtime monitoring
Live dashboards, chat, notifications, trading tickers, collaborative editors: more and more features run over WebSocket and realtime endpoints rather than classic HTTP requests. Yet these connections are a blind spot in most monitoring, because a normal uptime check often returns HTTP 200 for a wss:// URL even when the handshake fails, the ping/pong heartbeats stop, or messages never arrive. The cost is real: according to ITIC 2024, 41% of large enterprises put a single hour of downtime at USD 1 to 5 million (ITIC 2024), while Gartner has historically estimated unplanned outages at roughly USD 5,600 per minute (Gartner). This guide shows how to monitor WebSocket and SSE endpoints across the full lifecycle - from handshake through ping/pong and message round-trip to reconnect - and how browser monitoring with synthetic checks covers the realtime features a simple ping never sees.

Why Realtime Endpoints Slip Through Classic Uptime Monitoring

A WebSocket starts as an ordinary HTTP request with an Upgrade header and is switched to the WebSocket protocol by the server with the status code 101 Switching Protocols (RFC 6455, IETF). That is exactly the problem for classic monitoring: many uptime checks only verify that the HTTP endpoint is reachable and returns a 2xx or 101 status. Whether a working bidirectional channel actually forms afterwards, carrying real messages, goes unchecked.

This is no longer an edge case. The widely cited study from the Web Conference 2021 documented that WebSockets are a firm part of the modern web and that the share of encrypted wss:// connections keeps rising (Web Conference 2021). The 2025 Web Almanac by HTTP Archive confirms that secure WebSocket origins increase across measurement snapshots (HTTP Archive Web Almanac 2025). In parallel, industry analyses expect demand for realtime features to keep growing strongly, because users expect real-time interactivity (618media 2025).

The decisive difference: a website can be fully reachable - the home page loads, login works - and the live feature is still broken. If the WebSocket fails, users see a frozen dashboard, a chat with no new messages, or a cart that does not update. This is exactly the gap closed by monitoring that checks the entire connection lifecycle instead of just the first HTTP status.

On top of that, realtime failures often appear gradually and are hard to reproduce. A WebSocket can work flawlessly in the morning and drop under load in the afternoon, because a load balancer cuts the connection after an idle period, a new deployment changes the upgrade path, or an upstream CDN node fails to pass the Upgrade header. Such failures arise outside the usual test scenarios and show up in no server log, because from the web server's point of view everything is fine. Only a continuous check executed from the outside makes them visible - and does so before the first support ticket arrives.

HTTP 200 Does Not Mean Realtime-OK

A status 200 or 101 check only says the server accepts the handshake. It says nothing about whether messages flow after the upgrade, whether heartbeats are answered, or whether the connection drops seconds later with code 1006 (abnormal closure). Realtime endpoints need a check that actually opens and uses the connection.

The WebSocket Lifecycle: Four Phases That Need Monitoring

A robust realtime check follows the natural lifecycle of a WebSocket connection. Each phase has its own failure modes - and each yields its own meaningful metric. Checking only one phase misses the other three.

1. Handshake

The HTTP upgrade to 101 Switching Protocols. This is where TLS errors, wrong Sec-WebSocket-Accept headers, rejected origins, or a reverse proxy swallowing the upgrade show up. Metric: handshake time and success rate.

2. Open and Heartbeat

After readyState 1, ping/pong keeps the connection alive. The server sends a ping (opcode 0x9), the client replies with a pong (opcode 0xA) - 2 bytes of overhead plus up to 125 bytes of payload (RFC 6455). Metric: pong rate and heartbeat latency.

3. Message Round-Trip

Send a test message and wait for the echo via onmessage. This measures true end-to-end latency including server processing. Metric: message RTT as median and p95.

4. Close and Reconnect

When the connection drops (code 1006), reconnect logic with backoff kicks in. Unlike SSE, WebSockets have no built-in reconnect (Ably). Metric: reconnect frequency and reconnection time.

One quirk matters especially for monitoring: the browser WebSocket API gives JavaScript no direct access to ping/pong frames - the browser answers server pings automatically at the protocol level (WebSocket.org). Synthetic checks from a real browser context can therefore observe the heartbeat only indirectly via connection state and application heartbeats, while a protocol client sees the frames directly. Good realtime monitoring combines both perspectives.

In practice, many applications therefore combine the protocol heartbeats with an additional application-level heartbeat: the server sends a small JSON message at a fixed cadence, such as {"type":"heartbeat"}, which the client sees in its onmessage handler and answers. A browser-based check can observe and evaluate exactly these application-level messages - so it verifies not just that the connection is formally open, but that data is actually still flowing at the application layer. If the expected heartbeat fails to arrive, the connection is most likely a zombie, even if readyState still reports 1.

Handshake Monitoring: Where Most Connections Fail

The handshake is the most common point of failure - and the easiest to overlook. The client sends an HTTP request with Connection: Upgrade, Upgrade: websocket, and a random Sec-WebSocket-Key. The server must compute the correct Sec-WebSocket-Accept value from it and reply with status 101 (RFC 6455). If any of these steps fails, no connection is ever established.

WebSocket handshake (simplified)
GET /socket HTTP/1.1
Host: live.your-domain.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13
Origin: https://your-domain.com

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=

Typical handshake problems a synthetic check reliably surfaces: an expired or misconfigured TLS certificate on the wss:// endpoint, a reverse proxy or WAF that does not pass through the Upgrade header, a rejected origin due to a faulty allowlist, or simply an overloaded server that completes the handshake only after several seconds. Because the handshake sits on top of HTTPS, continuous certificate checking belongs to it - as provided by SSL certificate monitoring.

Origin Validation Belongs in Monitoring

The same-origin policy does not restrict WebSocket connections - protection against cross-site WebSocket hijacking (CWE-1385) rests solely on server-side origin validation (OWASP WebSocket Security Cheat Sheet). A synthetic check that connects with both a correct and a foreign origin reveals whether the allowlist holds - a security and functional indicator at once.

Ping/Pong and Message Round-Trip: Measuring Real Latency

Once the connection is open, the real work of monitoring begins. The ping/pong mechanism from RFC 6455 serves two purposes: it detects dead connections (so-called zombies) and prevents reverse proxies from closing idle connections (WebSocket.org). A common rule of thumb is to set the heartbeat interval to about 75% of the shortest proxy timeout - so roughly every 45 seconds for a typical 60-second timeout (WebSocket.org).

The most meaningful value is the message round-trip (RTT): a test message is sent and the time until the reply arrives via onmessage is measured. Unlike the handshake alone, the RTT measures the full processing chain including server logic. To put latency in context: WebSocket binary framing runs about 1 to 3 milliseconds per message, SSE closer to 5 to 10 milliseconds - but in practice network RTT and backend processing dominate the latency budget (WebSocket.org). That is precisely why the end-to-end measurement at the endpoint is so much more meaningful than a theoretical figure.

MetricWhat it measuresAlert threshold (example)
Handshake timeTime to HTTP 101slower than 1 s
Handshake successShare of successful upgradesbelow 99% in 24 h
Pong rateHeartbeats answeredbelow 100% over 2 intervals
Message RTT (median)send to onmessageabove 250 ms
Message RTT (p95)Outlier latencyabove 500 ms
Reconnects/hourDropped connectionsmore than expected

These thresholds are examples - sensible values depend on the application. A trading ticker has a different latency budget than a background notification channel. What matters is that the values are captured at all and checked against an expected range. How such thresholds can be derived from real user behavior is described in the article on recording and automatically monitoring browser flows.

The RTT measurement becomes especially telling when viewed not as a single value but as a distribution over time. A stable median with a rising p95 points to individual but increasingly severe outliers - often a precursor of overload before the connection drops entirely. If the median itself rises, the whole processing chain is slowing down, for instance because of an overloaded database behind the realtime server. Observing both percentiles separately reveals a degradation days before it turns into a visible outage - allowing you to act rather than merely react.

A second pitfall lies in the interplay with reverse proxies and load balancers. Many of these components close a WebSocket connection after a fixed idle period of typically 60 to 100 seconds (WebSocket.org). If the heartbeat is missing or the interval is set too long, the infrastructure cuts the connection - and monitoring registers a seemingly unexplained drop. A check that knows the heartbeat behavior and sets the interval appropriately reliably distinguishes a genuine server problem from a mere timeout configuration.

Reconnect and Drop Detection: The Moment That Counts

Unlike Server-Sent Events, WebSockets bring no built-in reconnect logic; developers must implement reconnection themselves (Ably). SSE, by contrast, automatically attempts to restore a lost connection, which makes it especially robust for server push, live feeds, and notifications (Ably). This asymmetry is central to monitoring: for WebSockets the check must verify that the client-side reconnect logic actually works and how long reconnection takes.

The most common drop indicator is the close code 1006 (abnormal closure) - it signals that the connection ended without a clean close frame, for example due to a network error, a proxy timeout, or a server crash. A good realtime check detects this state, triggers a reconnect attempt, and reports when reconnection fails or takes unusually long. It is exactly this moment - the seconds between drop and successful reconnect - that decides whether users notice an outage.

Exponential backoff makes sense: after the first failed attempt the client waits briefly, then progressively longer, up to a maximum - complemented by a small random component (jitter) so that after a server restart not all clients reconnect at once and overload the server again. From a monitoring perspective, two values are central: the number of reconnects per hour and the average reconnection time. If both rise, the connection is unstable, even if the endpoint keeps appearing reachable in between - a pattern a plain ping never uncovers.

From Dead Socket to Alert

A dropped WebSocket is invisible in classic monitoring - the HTTP endpoint stays reachable, after all. Only a check that opens the connection, performs a round-trip, and reacts to close code 1006 as well as missing pongs turns the silent failure into a concrete alert - before the first user reports a frozen dashboard.

WebSocket vs. SSE: What to Monitor and When

Not every realtime feature needs a WebSocket. Server-Sent Events (SSE) are a lightweight, HTTP-based one-way channel from server to client - ideal for live feeds, dashboards, and notifications. Analyses from 2025 argue that SSE is the simpler, more scalable, and more robust solution for a large share of typical realtime features, because the text-based format is easier to monitor and comes with automatic reconnects (dev.to 2025). WebSockets show their strength where true bidirectional communication is needed - chat, collaborative editing, multiplayer.

  • Monitor SSE: keep the HTTP connection open, receive event: and data: lines, check Last-Event-ID for the reconnect. Since SSE sits on top of HTTP/2, the HTTP/3 and QUIC protocol monitoring is worth a look for the transport layer.
  • Monitor WebSocket: handshake, readyState, ping/pong, message RTT, and reconnect - the full lifecycle described above.
  • Both together: TLS certificate of the wss:// or https:// endpoint, reachability from multiple locations, and latency against a target value.
  • Mind mobile: measurements show roughly 2 to 3 times the battery drain for WebSocket versus HTTP streaming on mobile devices (WebSocket.org) - an argument for preferring SSE where possible and monitoring both paths.

For monitoring this means: the check must match the protocol. An SSE check waiting for WebSocket frames will fail - and vice versa. Platforms that understand both patterns cover the entire realtime layer instead of just part of it. Combined with GraphQL API monitoring, this builds a complete picture of the modern, API-driven application layer.

Monitoring Realtime Endpoints with Synthetic Browser Checks

The most effective approach to realtime monitoring is synthetic checks from a real browser or protocol context: a script that opens the connection just like a real user, sends a message, waits for the reply, and checks the result against expected values. This is the same logic behind browser monitoring with synthetic checks - just applied to the realtime layer.

XICTRAQ browser monitoring runs scriptable checks in a real browser context and can thus model the full WebSocket lifecycle: open the handshake, wait for readyState 1, send a test message, measure the echo via onmessage, and react to close codes such as 1006. If a metric deviates from the target state - the handshake fails, the RTT rises above the threshold, or the connection drops - the monitoring triggers an alert via email, Slack, Discord, Telegram, or Microsoft Teams.

It is crucial that the check runs from several geographic locations. A realtime endpoint can be perfectly reachable from one data center and stall from another network behind a misconfigured routing rule. When handshake time and message RTT are captured per location, a regional problem can be told apart from a global one - and latency checked against the expectation of each user group. Especially for applications with an audience in several countries, this is the difference between an unnoticed partial outage and a well-founded diagnosis.

Realtime checks are not an isolated topic. They feed into the same chain as the other functional checks: a live cart that updates over WebSocket belongs to the same critical path as the checkout itself. How to check such business processes end to end is shown in the articles on monitoring login flow and checkout and on e-commerce monitoring for online shops.

The economic lever is considerable. If, according to ITIC, 41% of large enterprises put an hour of downtime at USD 1 to 5 million (ITIC 2024) and Gartner historically assumes around USD 5,600 per minute (Gartner), then early detection of a dead realtime channel is direct damage reduction. A frozen live dashboard that goes unnoticed for hours costs trust - and in doubt, revenue. As a German provider, XICTRAQ is built to current GDPR requirements and operates its monitoring nodes in German data centers.

Sources and Studies

This article draws on data from: IETF (RFC 6455 - The WebSocket Protocol, handshake, ping/pong opcodes, close codes), HTTP Archive (Web Almanac 2025, secure WebSocket origins), Web Conference 2021 (WebSocket Adoption and the Landscape of the Real-Time Web, Murley et al.), WebSocket.org (heartbeat interval, ping/pong, latency framing, mobile battery drain), Ably (WebSockets vs. Server-Sent Events, reconnect behavior), OWASP (WebSocket Security Cheat Sheet, CWE-1385 cross-site WebSocket hijacking), ITIC (Hourly Cost of Downtime 2024), Gartner (cost of unplanned outages), 618media (real-time trends 2025), dev.to (Server-Sent Events vs. WebSockets 2025). Statistics may have changed since publication.

Frequently Asked Questions on WebSocket and Realtime Monitoring

Is a normal uptime check enough for a WebSocket endpoint?
Usually not. A classic check typically only verifies that the HTTP endpoint is reachable and returns a 2xx or 101 status. Whether messages actually flow after the upgrade, heartbeats are answered, and the connection stays stable is something it generally does not see. For realtime features, a synthetic check that opens and uses the connection is advisable.
How do you measure a WebSocket's latency meaningfully?
The most meaningful value is the message round-trip: send a test message and measure the time until the reply arrives via onmessage, ideally as a median and a p95 value. This captures the full processing chain including server logic. The handshake alone or a ping/pong value complement the picture but cover only partial aspects.
What does close code 1006 mean in monitoring?
Code 1006 stands for an abnormal connection closure without a clean close frame - often caused by network errors, proxy timeouts, or server problems. In monitoring it is an important signal: it shows the connection ended unexpectedly and should typically trigger a reconnect attempt and, when frequent, a notification.
Should I use WebSocket or Server-Sent Events?
It depends on the use case. Server-Sent Events are generally more robust and simpler for pure server-to-client streams such as dashboards, feeds, and notifications, because they bring automatic reconnects. WebSockets are the choice when true bidirectional communication is needed, such as chat or collaborative editing. Both paths should be monitored.
Can monitoring detect cross-site WebSocket hijacking?
A synthetic check can at least verify whether the server-side origin allowlist holds, by connecting with both a correct and a foreign origin. Since the same-origin policy does not restrict WebSocket connections, according to OWASP protection rests solely on this server-side validation. Such a test does not replace a full security audit but is a useful functional and security indicator.
How often should realtime endpoints be checked?
That depends on how critical the feature is. For business-critical live features a tight interval is usually advisable so that a dead channel is noticed quickly. Above all, it matters that the check covers the full lifecycle and verifies the metrics against an expected range, rather than only testing HTTP reachability.

Related in XICTRAQ

Start in 60 seconds

Let XICTRAQ watch your website.

Permanent free plan available. No credit card, no installation, no hidden fees.