Skip to content

Inspect traffic

WebSocket and GraphQL

Inspect WebSocket frames and GraphQL operations in Cloak Proxy. Filter messages by direction, search payloads, and read formatted queries and variables.

Two kinds of traffic get their own views in the inspector. WebSocket connections show every frame sent and received in a Messages tab, live as they arrive. GraphQL requests sent over HTTP get a GraphQL tab with the query formatted and the variables in a JSON tree, and the operation name shows in the traffic list.

Cloak Proxy recognizes a WebSocket when the request asks to upgrade the connection (an Upgrade: websocket header). It relays the frames between the app and the server and records each one.

  1. Make sure the connection is decrypted. For wss:// connections, turn on SSL Proxying for the host or the app. Plain ws:// connections need nothing extra.

  2. Click the WebSocket chip in the filter bar to find WebSocket connections quickly.

  3. Select the connection in the traffic list.

    The response pane shows a Messages tab, with the frame count, in place of Body. The other response tabs are Header, Set-Cookie (when the handshake set cookies) and Raw.

  4. Click a message to see its contents in the lower half of the pane.

Frames on a WebSocket connection. Sent frames have a blue up arrow, received frames a green down arrow.

  1. Show all frames, or only sent or received
  2. Hide ping and pong frames (on by default)
  3. Search text messages
  4. How many frames are shown
  5. The selected frame's contents
The Messages tab of a WebSocket connection: All, Sent and Received buttons, a Hide ping/pong checkbox, a search field, the count 3 of 4 messages, and a table of a sent subscribe message, a received order message and a sent binary frame
Column Shows
Direction A blue up arrow for frames the app sent, a green down arrow for frames it received
Time When the frame passed through, to the millisecond
Type text, binary, ping, pong, close or continuation
Size The payload size
Data Text payloads on one line. Other frames show their type, such as <binary data> or <ping data>.
Control What it does
All / Sent / Received Shows every frame, or only one direction
Hide ping/pong Hides keep-alive frames. On by default.
Search messages Shows text frames that contain your text, ignoring case. Binary frames are skipped while searching.
Count N messages, or N of M messages while filtering

Select a frame and its payload opens in the body viewer below the table. JSON text opens as a tree you can filter and query with JSONPath or jq. Other text opens as Raw, and binary payloads that aren’t text open in Hex. Until you select one, the lower half says Select a message to see its contents.

While the connection is open but quiet, the tab shows Connected. Waiting for messages…. If it closed without any frames, it shows No messages were exchanged.

To send your own WebSocket messages, use the WebSocket client in the API client.

Most GraphQL APIs send every operation to the same URL, often /graphql, which makes them hard to tell apart in a list. Cloak Proxy reads the request body and labels each one.

A request counts as GraphQL when:

  • it’s a POST or GET request,
  • its Content-Type contains json, or its path contains graphql, and
  • its body is a JSON object with a query string (bodies up to 2 MB).

The Path column starts with a pink badge naming the operation, such as query GetUser or mutation UpdateCart. The name comes from the body’s operationName, or from the query document itself (query GetUser(…)). Anonymous operations show only the type: query, mutation or subscription.

Click the GraphQL chip in the filter bar to show only GraphQL requests. GraphQL requests also count as JSON.

The request pane gets a GraphQL tab with two parts.

The query, formatted, above its variables.

  1. The query, re-indented
  2. Variables in a JSON tree
The GraphQL tab: the query GetUser with an id variable, formatted over several lines, above a Variables tree with id set to the string 42
Part Shows
Query The query document, re-indented with one field per line, as selectable text. Press ⌘ F inside it to search.
Variables The variables object in a JSON tree, with filtering and JSONPath or jq queries. No variables when there are none.

Drag the line between the two parts to resize them. If the body can’t be read as JSON, the tab says The body isn’t valid GraphQL JSON.

The response is ordinary JSON, so it opens in the Body tab’s tree view, where you can filter for errors or query $.data.

To write and send GraphQL queries yourself, use the GraphQL client.