Work with WebSocket messages

WebSocket messages are data packets sent over a WebSocket connection. WebSocket messages include information about the type and length of the message, and whether it's the final message or part of a larger set of messages. You can send, save, and view WebSocket messages in Postman. You can also add names and arguments to Socket.IO events.

Send WebSocket messages

After making a WebSocket connection, you can use the editor pane to compose and send messages.

WebSocket message editor

In the bottom left corner of the editor, you can select the format of your message: Text, JSON, XML, HTML, or Binary. If you select Binary, you can then select Base64 or Hexadecimal. The editor has syntax highlighting according to the selected format. You can also select {} to beautify JSON, XML, or HTML messages.

After you finish composing your message, select Send. The sent message remains in the window, in case you want to change it and resend, or save it.

Save and load WebSocket messages

You can save composed messages, then load and resend them later.

To save a message, do the following:

  1. Compose a message (see Send WebSocket messages).
  2. Select Save to save the message with the request.
  3. (Optional) Select Saved messages, then select the Add message icon Add message icon to create a new blank message and add it to the list of saved messages.

To load a saved message, do the following:

  1. Select Saved messages to open the Saved messages pane.
  2. Select a saved message. It appears in the editor pane.

You can then send the message or edit it and select Save to save the changes.

View WebSocket messages

The Response pane displays a list of messages for the WebSocket connection, including incoming, outgoing, and network messages.

At the top of the Response pane is a connection details badge. It shows if the connection is connecting, connected, disconnecting, or disconnected. Hover over the badge to show connection details. Select the arrow next to the badge to show or hide the Response pane.

WebSocket messages

The Response pane has the following controls:

  • Search control - Enter a search term to display messages containing the term. Select Close icon to end the search.
  • Message type list - Choose to view all messages, sent messages, or received messages.
  • Clear messages - Select to clear all messages.

The following are displayed for each message:

  • If you hover over a message, a checkbox and three icons appear.
    • To see the time difference between two messages, select their checkboxes. Clear the checkboxes to remove the time display.
    • Select the Copy message icon Copy message icon to copy the message to your clipboard.
    • Select the Save message icon Save message icon to save the message
    • To see a message's size, time, and MIME type, hover over the information icon Information icon.
  • The time is displayed as your local time.
  • Select a message to expand or collapse it.

In an expanded message:

  • To change the formatting of the message, select Text, HTML, JSON, or XML.
  • To add or remove line wraps, select Wrap Line.
  • To show the message in hex or text, select Show Hexdump or Show Message.
  • To search the body of the message, use the search control.
  • To expand or collapse message blocks, hover over a line number and select the arrow.

Add Socket.IO event names and arguments

To listen to specific events, you can add names and arguments to events you send with a Socket.IO connection.

For a Socket.IO connection, you can enter an event name to publish next to Send. If you select Send without entering a name, the default name message is used.

If you select the Ack option, the server will acknowledge that it has received the message.

You can also add arguments to a Socket.IO connection. Select + Arg in the editor pane. A sidebar opens with a new argument that you can use to add the argument’s message. Hover over an existing argument and select x to delete it. The workflow to inspect each argument’s message is similar.

Socket.IO arguments

Last modified: 2023/11/01