← Back to Home

WebSocket Echo

/ws
WebSocket echo server that echoes back any message you send with a timestamp. Perfect for testing WebSocket connections and real-time communication. The playpen shows connection info - use a WebSocket client to connect and send messages.
Try it now

Examples

curl
curl --no-buffer \
  --include \
  --header "Connection: Upgrade" \
  --header "Upgrade: websocket" \
  --header "Sec-WebSocket-Version: 13" \
  --header "Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==" \
  https://tcpdata.com/ws
websocat (CLI tool)
# Install: cargo install websocat
websocat wss://tcpdata.com/ws
JavaScript
const ws = new WebSocket('wss://tcpdata.com/ws');
ws.onmessage = (e) => console.log('Echo:', e.data);
ws.send('Hello WebSocket!');
Python (websockets)
import asyncio
import websockets

async def test():
    async with websockets.connect('wss://tcpdata.com/ws') as ws:
        await ws.send('Hello WebSocket!')
        response = await ws.recv()
        print(f'Echo: {response}')

asyncio.run(test())