Skip to content

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:

Testing Capabilities

Our echo server excels at several testing scenarios:

  1. Connection Testing: Verify WebSocket handshake and connection establishment
  2. Message Round-Trip: Test message sending and receiving with guaranteed echo
  3. Proxy Validation: Confirm WebSocket traffic passes through corporate proxies
  4. Library Testing: Validate WebSocket client library implementations
  5. Performance Testing: Measure round-trip latency and throughput
  6. 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 server
const socket = new WebSocket('wss://echo.websocket.org');
// Connection opened
socket.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 messages
socket.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 errors
socket.addEventListener('error', (event) => {
console.error('WebSocket error:', event);
});
// Connection closed
socket.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:

Terminal window
# Install wscat globally
npm install -g wscat
# Connect to the echo server
wscat -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 connection
const eventSource = new EventSource('https://echo.websocket.org/.sse');
// Listen for messages
eventSource.onmessage = (event) => {
console.log('SSE message received:', event.data);
};
// Handle connection open
eventSource.onopen = () => {
console.log('SSE connection established');
};
// Handle errors
eventSource.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

This echo server is sponsored by Ably, a realtime data delivery platform that provides scalable, reliable and secure WebSocket infrastructure for apps and services.