Skip to content
subcloakdocs

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. GraphQL subscriptions, over a WebSocket or SSE, get their own GraphQL tab on the response, described in Streaming responses.

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. Since 0.5.1 Servers with a self-signed certificate need to be in Servers without certificate checks, and a server that asks for a client certificate gets the one in Client certificates, as for HTTPS requests. When the connection to the server fails, the app gets 502 Bad Gateway and the socket in the list says why.

  2. Click the WebSocket tab 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. A message over 1 MB shows truncated with its full size. Since 0.5.1
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.

A 1.3 MB message, kept up to 1 MB and marked truncated. The app and the server got all of it.

The Messages tab of a WebSocket connection: a subscribe message sent, an order message received, a 4-byte binary frame sent, and a 1 MB text message received marked truncated (1.3 MB) after its data

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 its body (up to 2 MB) is a JSON object with a GraphQL query document or a persisted-query operationName, a batch (a JSON array of those), an application/graphql document, or when a GET request has a query parameter holding a GraphQL document. A search API’s {"query": "red shoes"} doesn’t count. See GraphQL operations for the details.

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 tab in the filter bar to show only GraphQL requests. GraphQL requests also count as JSON.

Since 0.4.0 A 200 whose body has a GraphQL errors array shows a red 200 ✕ status and a red banner above the response, and the sidebar’s GraphQL group lists every operation. To find one operation, click it there, or filter with Match in › GraphQL. See GraphQL errors in a 200 response.

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. For a batch, the tab shows the first operation; for a GET request, the query and variables from the URL. If the request can’t be read as GraphQL, 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.

For subscriptions and responses that arrive in parts (@defer, @stream), see GraphQL subscriptions. To write and send GraphQL queries yourself, use the GraphQL client.