Test WebSocket connections — connect to any endpoint, send and receive messages in real-time
wss:// for secure WebSocket connections (WebSocket over TLS, the standard for production) or ws:// for unencrypted connections (development/localhost only). Choose from preset endpoints for quick testing: the Echo Test preset (wss://ws.postman-echo.com/raw) echoes back any message you send — perfect for verifying connectivity and message round-trip; the Public Echo preset (wss://echo.websocket.org) provides an alternative public echo service. WebSocket is the foundational protocol for real-time web applications — chat systems, live dashboards, collaborative editing, gaming, financial tickers, and any application requiring server-to-client push without polling.WebSocket, HTTP, and SSE each serve different communication patterns. <strong>HTTP (request-response)</strong>: client sends a request, server sends a response, connection closes. Best for: REST APIs, static resource loading, form submissions — any request-initiated interaction. <strong>HTTP Long Polling</strong>: client sends request, server holds it open until data is available or timeout. Simpler than WebSocket but wastes resources holding open connections and re-establishing them after each response. <strong>Server-Sent Events (SSE)</strong>: server-to-client unidirectional stream over HTTP. Simpler than WebSocket, auto-reconnects natively, works through most proxies. Best for: live feeds, notifications, status updates where the client only receives data. <strong>WebSocket</strong>: full-duplex bidirectional communication over a persistent TCP connection. Lowest latency, least overhead (no HTTP headers per message after the initial handshake), supports binary and text frames. Best for: chat, collaborative editing, real-time games, financial tickers, any app requiring frequent two-way communication. WebSocket requires a dedicated server implementation and may have issues with corporate firewalls that don't support the Upgrade header. The PivaBox WebSocket Tester helps you experiment with WebSocket connections directly in your browser.
The WebSocket connection lifecycle: (1) <strong>Handshake</strong> — the client sends an HTTP GET request with <code>Upgrade: websocket</code> and <code>Connection: Upgrade</code> headers, plus a <code>Sec-WebSocket-Key</code> (a random Base64 value). The server validates this and responds with HTTP <code>101 Switching Protocols</code>, a <code>Sec-WebSocket-Accept</code> header (SHA-1 hash of the client key + a fixed GUID), and the connection upgrades from HTTP to the WebSocket protocol. (2) <strong>Data transfer</strong> — after the handshake, data flows as WebSocket frames (not HTTP messages). Frames can be text (UTF-8) or binary (Blob/ArrayBuffer). (3) <strong>Closure</strong> — either side can initiate close with a status code. Common close codes: <code>1000</code> Normal Closure (intentional, clean disconnect), <code>1001</code> Going Away (server shutting down or page navigating away), <code>1006</code> Abnormal Closure (connection lost without close frame — network issue, server crash), <code>1008</code> Policy Violation (endpoint rejected due to policy), <code>1011</code> Internal Server Error. The WebSocket Tester displays close codes and reasons to help diagnose connection issues.
WebSocket connections are subject to browser security policies: (1) <strong>Same-Origin Policy does NOT apply</strong> — unlike XMLHttpRequest and Fetch, WebSocket connections can connect to any origin; the server decides whether to accept the connection by checking the <code>Origin</code> header in the handshake request. (2) <strong>Mixed content blocking</strong> — <code>ws://</code> connections from <code>https://</code> pages are blocked by most modern browsers (insecure WebSocket on secure page); always use <code>wss://</code> from HTTPS origins. (3) <strong>TLS encryption (wss://)</strong> — WebSocket Secure uses the same TLS encryption as HTTPS; all data after the initial handshake is encrypted end-to-end. The handshake itself contains the <code>Origin</code> header (visible unencrypted in the HTTP Upgrade request) but all subsequent message frames are encrypted. (4) <strong>Authentication</strong> — WebSocket does not have a built-in authentication mechanism; common patterns include: sending a token as a query parameter in the connection URL (<code>wss://api.example.com/ws?token=xxx</code>), sending credentials in the first message after connection, or using cookies (same-origin WebSocket connections automatically include cookies from the handshake). (5) <strong>Rate limiting</strong> — browsers limit the number of concurrent WebSocket connections per origin (typically 6–255 depending on browser). The PivaBox WebSocket Tester operates entirely from your browser — no data passes through our servers.