Skip to main content

WebSocket Tester

Test WebSocket connections

disconnected

Was this WebSocket Tester helpful?

Help us keep tools reliable, fast, and bug-free.

What you can do with WebSocket Tester

  • Test websocket connection
  • Connect to ws server

What this network diagnostic measures

Connect to public and private WebSocket (ws:// and wss://) endpoints, inspect frame traffic in real-time, send custom text or JSON frames, and monitor heartbeats.

Example input

Connection URL: wss://echo.websocket.events, Send: {"type": "ping", "timestamp": 1718000000}

Example output

Connection Established (101 Switching Protocols). Received frame: {"type": "ping", "timestamp": 1718000000} (Roundtrip: 38ms)

Practical workflow

  1. Enter your WebSocket server endpoint URL starting with ws:// (unencrypted) or wss:// (TLS-encrypted).
  2. Optionally specify custom subprotocols required by your server implementation.
  3. Click Connect to establish the 101 Switching Protocols handshake and monitor connection status.
  4. Send text or JSON frames via the message composer and view directional incoming/outgoing message logs.

Common use cases

  • Debugging real-time chat, multiplayer gaming, and financial market data WebSocket streams.
  • Testing WebSocket server heartbeat ping/pong mechanisms and automated reconnection handling.
  • Verifying JSON message validation and serialization protocols in real-time backend services.

Important notes and limitations

  • Operates via the browser native WebSocket interface, providing precise millisecond frame timestamps.
  • Supports automatic reconnection retries with exponential backoff for resilience testing.

Terminal WebSocket testing & debugging tools

Connect to WebSocket server with wscat

wscat -c wss://echo.websocket.org

Establishes an interactive terminal session to send text and receive frame streams over secure WebSockets.

Inspect WebSocket HTTP/1.1 Upgrade handshake via cURL

curl -i -N -H 'Connection: Upgrade' -H 'Upgrade: websocket' -H 'Sec-WebSocket-Version: 13' -H 'Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==' https://echo.websocket.org

Simulates browser 101 Switching Protocols handshake to verify proxy and edge gateway WebSocket support.

Send WebSocket ping frame with websocat

websocat -t --ping-interval 10 wss://api.example.com/ws

Connects to a WebSocket endpoint with automated keepalive ping frames every 10 seconds to prevent edge idle timeouts.

WebSocket handshake & disconnect troubleshooting

WebSocket connection failed: Error during WebSocket handshake: Unexpected response code: 502 / 504

Cause: Reverse proxy (Nginx / Cloudflare) is not configured to forward 'Upgrade' and 'Connection' hop-by-hop headers.

Solution: Configure Nginx with 'proxy_set_header Upgrade $http_upgrade;' and 'proxy_set_header Connection "upgrade";'.

WebSocket is closed before the connection is established (Code 1006)

Cause: Abnormal closure due to TLS certificate validation failure, TCP connection reset, or proxy idle timeout.

Solution: Check WSS certificate validity, configure client keepalive ping/pong frames, and handle onclose reconnection with exponential backoff.

Continue your workflow

Frequently asked questions

What is the difference between ws:// and wss:// protocols?

ws:// transmits unencrypted plaintext data over standard TCP port 80, whereas wss:// encrypts all frame traffic using TLS over port 443, identical to the difference between HTTP and HTTPS.

Can I inspect binary WebSocket frames (ArrayBuffer / Blob)?

Yes. The frame logger detects binary message frames and displays byte length summaries alongside hexadecimal previews.

Why does a WebSocket connection fail with an immediate closure error?

Immediate connection closure typically stems from TLS certificate mismatches, missing CORS handshake headers, or invalid subprotocol negotiation.