Skip to content

WebSocket ​

Open a WebSocket connection, send messages by hand and watch everything the server sends back, in one tab.

What a WebSocket is ​

A normal HTTP request is one question and one answer. A WebSocket is a connection that stays open, so the client and the server can both send messages at any time. Chat apps, live prices and multiplayer games use it.

A WebSocket address starts with ws:// (plain) or wss:// (encrypted), the same way web addresses start with http:// or https://.

Make your first connection ​

This example uses wss://echo.websocket.org, a public test server that sends back every message it receives.

  1. In the tab bar, select the small arrow next to + and choose WebSocket.

    A tab named New WebSocket opens with wss:// in the URL field.

  2. Type wss://echo.websocket.org in the URL field.

  3. Select Connect, or press Enter in the URL field.

    The status changes from Disconnected to Connecting… and then Connected. The log in the lower pane notes the connection, and this server sends one greeting line.

  4. On the Message tab, type hello in the Message box.

  5. Select Send.

    The log lists your message as Sent and the server's copy as Received, each with its time and size.

  6. Select Disconnect when you are done.

Good to know

Public test servers can change or go away. Any WebSocket server works the same way, including one running on your own computer, for example ws://localhost:8080.

Write messages ​

The Message tab is the composer. Pick the message type first:

TypeWhat is sent
TextThe text exactly as typed.
JSONThe text, after a check that it is valid JSON. The log shows it indented. Format re-indents what is in the box.
BinaryThe bytes of the base64 text you type, for example SGVsbG8=.

Variables such as {{token}} are filled in when you send. Send is available only while the connection is open.

Saved messages ​

Keep messages you send often with the request:

  1. Write the message in the Message box.

  2. Select Save message and give it a name.

  3. Under Saved messages, use the send icon to send it, the pencil to put it back in the box, or the cross to delete it. Select the name to rename it.

Params and headers ​

  • Params are added to the end of the URL as its query string when you connect.
  • Headers are sent with the upgrade request that opens the connection. Use them for a token, for example Authorization: Bearer {{token}}.

Unticked rows are kept but not sent. An address that starts with http:// or https:// is connected as ws:// or wss://.

Connection settings ​

The Settings tab holds the options for this connection.

SettingWhat it doesDefault
SubprotocolsNames offered in the Sec-WebSocket-Protocol header, separated by commas, for example graphql-ws. The server picks one, or none.Empty
Ping interval (seconds)How often a ping frame is sent to keep the connection alive. 0 sends no pings.0
Reconnect automaticallyWhen the connection drops or cannot be made, try again after a wait that doubles each time. Disconnect stops it.Off
AttemptsReconnect attempts in a row before giving up. 0 keeps trying.5
First wait (ms)The wait before the first reconnect attempt.1000
Longest wait (ms)The wait never grows beyond this.30000

A connection attempt that gets no answer within 20 seconds is given up.

Encrypted (wss://) connections follow the app's Verify TLS certificates setting, the proxy and the extra CA certificate. See App settings and Proxy and certificates.

Read the message log ​

The lower pane lists every message with its direction, time and size. System notes record connecting, disconnecting and errors.

ControlWhat it does
Search messagesShows only entries that contain your text. Case does not matter.
FilterChooses which entries to list: Sent, Received and System notes.
HEX / B64Shows binary messages as hex bytes or as base64. Copied binary messages use the same format.
Auto-scrollFollows new messages. It pauses when you scroll up; select it to follow again.
Copy allCopies every listed message as plain text, with time, direction and size.
Clear the logEmpties the log. The connection stays open.

The log keeps the newest 2,000 entries and says how many older ones were dropped. A very long message is shortened on screen; copy the message to get all of it.

Save the connection ​

Select Save… above the URL to keep the tab in a collection. The URL, params, headers, settings, the draft message and your saved messages are stored with it. After that, Ctrl + S saves your changes.

Next steps ​