ToolActToolAct

WebSocket Online Test Tool

Online WebSocket connection test, message sending and receiving debugging tool

Disconnected
Messages Sent
0
Messages Received
0
Duration
00:00
Total Messages
0
Message Log

Connect to send and receive messages

Ctrl + Enter to send

What is WebSocket?

WebSocket is a protocol for full-duplex communication over a single TCP connection. Unlike HTTP, once a WebSocket connection is established, both client and server can send data at any time without repeatedly establishing connections. WebSocket is commonly used for real-time chat, online games, stock quotes, collaborative editing, and other scenarios requiring real-time data exchange.

How to Use

  1. Enter the WebSocket server address in the URL field (ws:// or wss://)
  2. Optional: enter subprotocols, separated by commas for multiple
  3. Click 'Connect' to establish WebSocket connection
  4. Enter the message content in the input field
  5. Select message type (Text or JSON), JSON type will auto-validate format
  6. Click 'Send' or press Ctrl + Enter to send message
  7. View sent and received messages in the message list, click to copy

Frequently Asked Questions (FAQ)

Q: What's the difference between WebSocket and HTTP?

A: WebSocket is a full-duplex protocol - once connected, both server and client can send data anytime. HTTP is request-response mode where each communication requires client to initiate request. WebSocket is better suited for real-time data exchange scenarios.

Q: What's the difference between ws:// and wss://?

A: ws:// is unencrypted WebSocket connection, similar to HTTP. wss:// is encrypted WebSocket connection, similar to HTTPS, with more secure data transmission. It's recommended to use wss:// in production environments.

Q: What is subprotocol?

A: Subprotocol is a protocol identifier negotiated during WebSocket handshake to agree on communication format. For example, 'json' indicates using JSON format. Server can verify if client's requested subprotocol is supported.

Q: Why does connection fail?

A: Possible reasons: wrong URL format, server not running, firewall blocking, CORS restrictions (browser security policy), certificate issues (wss://). Please check server configuration and network environment.