WebSocket Echo Server - Free Testing Tool for Real-Time Applications
Overview
The WebSocket Echo Server at echo.websocket.org
is a free, publicly available testing endpoint that has become an essential tool
for developers working with real-time web technologies. This server provides
instant echo responses for WebSocket connections, Server-Sent Events (SSE), and
standard HTTP requests, making it invaluable for testing, debugging, and
validating real-time implementations.
Unlike production WebSocket servers that implement complex business logic, our echo server provides a clean, predictable environment where every message sent is immediately echoed back. This simplicity makes it perfect for isolating connection issues, testing client libraries, validating proxy configurations, and debugging protocol-level problems.
Key Features
Multi-Protocol Support
The echo server supports three primary protocols, each accessible through different endpoints:
- WebSocket Protocol: Full-duplex communication at
wss://echo.websocket.org
- Server-Sent Events: One-way streaming at
https://echo.websocket.org/.sse
- HTTP Echo: Standard HTTP request/response at any other path
- Browser UI: Interactive testing interface at
https://echo.websocket.org/.ws
Testing Capabilities
Our echo server excels at several testing scenarios:
- Connection Testing: Verify WebSocket handshake and connection establishment
- Message Round-Trip: Test message sending and receiving with guaranteed echo
- Proxy Validation: Confirm WebSocket traffic passes through corporate proxies
- Library Testing: Validate WebSocket client library implementations
- Performance Testing: Measure round-trip latency and throughput
- Protocol Debugging: Inspect frames and connection behavior
How to Use the Echo Server
Quick WebSocket Test with JavaScript
Here’s a simple example to test the WebSocket echo server from any browser console:
// Connect to the WebSocket echo serverconst socket = new WebSocket('wss://echo.websocket.org');
// Connection openedsocket.addEventListener('open', (event) => { console.log('Connected to echo server');
// Send a test message socket.send('Hello, WebSocket Echo Server!');
// Send JSON data socket.send( JSON.stringify({ type: 'test', timestamp: Date.now(), message: 'Testing echo functionality', }) );});
// Listen for echoed messagessocket.addEventListener('message', (event) => { console.log('Echoed back:', event.data);
// Parse JSON if needed try { const data = JSON.parse(event.data); console.log('Received JSON:', data); } catch (e) { console.log('Received text:', event.data); }});
// Handle errorssocket.addEventListener('error', (event) => { console.error('WebSocket error:', event);});
// Connection closedsocket.addEventListener('close', (event) => { console.log('Disconnected from echo server'); console.log('Close code:', event.code); console.log('Close reason:', event.reason);});
Testing with Command Line Tools
You can also test the echo server using command-line tools like wscat
:
# Install wscat globallynpm install -g wscat
# Connect to the echo serverwscat -c wss://echo.websocket.org
# Type messages and see them echoed back> Hello from wscat!< Hello from wscat!
Server-Sent Events Testing
For SSE testing, you can use this JavaScript example:
// Create EventSource connectionconst eventSource = new EventSource('https://echo.websocket.org/.sse');
// Listen for messageseventSource.onmessage = (event) => { console.log('SSE message received:', event.data);};
// Handle connection openeventSource.onopen = () => { console.log('SSE connection established');};
// Handle errorseventSource.onerror = (error) => { console.error('SSE error:', error); if (eventSource.readyState === EventSource.CLOSED) { console.log('SSE connection closed'); }};
Technical Specifications
Connection Details
- Protocol: WebSocket Protocol Version 13 (RFC 6455)
- Secure Connection: TLS 1.2+ required for WSS
- Maximum Message Size: 64 KB per message
- Timeout: Connections timeout after 10 minutes of inactivity
- Concurrent Connections: Reasonable limits apply to prevent abuse
Endpoint Behavior
The echo server implements these specific behaviors:
- Immediate Echo: Messages are echoed back with minimal latency
- Message Preservation: Binary and text messages maintain their type
- No Message History: Each connection is independent with no persistence
- Clean Close: Proper WebSocket close handshake on disconnection
Sponsored by Ably
This echo server is sponsored by Ably, a realtime data delivery platform that provides scalable, reliable and secure WebSocket infrastructure for apps and services.