SockJS Test Client
Connect to a SockJS server to send and receive test messages over WebSocket or HTTP fallback transports.
Input
Output
Readme
What is SockJS?
SockJS is an open-source JavaScript library that provides a WebSocket-like API while transparently falling back to alternative transports when WebSocket is unavailable. It was designed for environments where WebSocket connections are blocked — for example, by corporate firewalls, older browsers, or load balancers that do not support connection upgrades. SockJS negotiates the best available transport automatically, choosing from WebSocket, HTTP streaming, HTTP long-polling, and several other mechanisms.
SockJS requires a compatible server-side library (such as the SockJS-Node or Spring's SockJS support) and speaks its own subprotocol, so it cannot connect to a plain WebSocket endpoint.
Tool description
This tool provides a browser-based SockJS client. Enter the URL of a SockJS server endpoint, connect, compose text messages, and observe all traffic in a timestamped message log. The active transport name (e.g., websocket, xhr-streaming, xhr-polling) is displayed in real time so you can see which fallback mechanism the library selected.
Features
- Automatic transport negotiation — connects with the best available transport and shows which one was selected.
- Live message log — all incoming messages and connection events are captured with timestamps for easy inspection.
- Text and JSON modes — write payloads as plain text or structured JSON with syntax highlighting and validation.
Options explained
Server URL — the HTTP(S) URL of the SockJS endpoint (e.g., https://example.com/sockjs). Do not append /websocket or any transport suffix; SockJS handles path negotiation internally.
Transport — displayed in the output area after the connection opens. Common values include websocket (direct upgrade succeeded), xhr-streaming (streaming over XHR), and xhr-polling (traditional long-poll). This field stays blank until the connection is established.
Data type — switch between Text and JSON composition modes. JSON mode validates the payload before sending.
Auto-scroll — keeps the message log pinned to the most recent entry.
How it works
The client uses the SockJS JavaScript library to open a connection to the target server. SockJS performs an information request to the server to discover which transports are supported, then negotiates the best option. Once connected, the tool relays all outgoing messages through the SockJS send method and logs every onmessage event returned by the server.
Tips
- SockJS servers typically expose their endpoint at a path like
/sockjsor/ws. Check the server documentation for the correct base URL. - If the transport shows
xhr-pollinginstead ofwebsocket, the server or proxy may be blocking WebSocket upgrades. - SockJS is not compatible with plain WebSocket endpoints. Use the WebSocket Test Client for standard WebSocket servers.