How to see your app’s WebSocket messages
The courier on the map isn’t moving, though it should be. A regular request can be repeated and its response read, but a WebSocket is a stream of messages that shows up in app logs only in fragments. Microkoi Bench records a WebSocket connection along with every message: what went out, what came in and how many seconds in.
Why WebSockets are hard to debug
Support chat, order status, courier location, new bids on a property auction — all of this often lives in one connection for minutes or hours. A bug in it doesn’t look like a bug: a message simply didn’t arrive, arrived twice or arrived with stale data.
Logs on the device usually show only what the app managed to parse. A message the parser dropped isn’t there. You need a view from the network side: which frames were actually sent.
Route the app through the Bench proxy
ws:// and wss:// connections go through the proxy just like regular requests. Start the proxy with “Start” in Traffic, set the proxy on the device and install the Bench root certificate to read wss://.
The connection appears in the list right away, without waiting for it to close, as a regular exchange with status 101. That’s how you find it: type part of the path, such as /ws, into search, or pick the host in the endpoint tree.
Open the “Messages” tab
A WebSocket exchange has two views above the panel. “Messages” opens by default, “Handshake” shows the connection request and its response — headers, cookies, a token in the query string.
- The arrow next to a message is its direction: ↑ sent by the client, ↓ pushed by the server.
- Next to it — time since the connection started, size and the start of the content.
- A click opens the whole message, JSON indented and highlighted.
- A binary message is shown as a hex dump with a column of printable characters.
{
"type": "courier.location",
"orderId": "ord-48213",
"lat": 55.7512,
"lng": 37.6184,
"eta": 540
}While the connection is open, the list keeps updating. The summary in the header — messages sent and received, total size and duration — fills in when the connection closes.
Find the right one among hundreds of messages
| Task | What to click |
|---|---|
| Only server messages | “↓ Received” |
| Only what the app sent | “↑ Sent” |
| Messages for one order | “Search messages” field: ord-48213 |
| Check the channel is alive | Turn on showing service ping and pong |
Service ping and pong messages are hidden by default; the toggle appears if there were any. A longer-than-usual gap between pings often explains why the connection drops in the subway.
What usually turns up
| What you see | What it means |
|---|---|
| ↓ messages arrive, the screen doesn’t change | Parsing error: a field has a format the app doesn’t expect |
| No ↑ subscription | The app didn’t resubscribe after reconnecting |
| The same ↓ twice | Two subscriptions to one channel |
| The connection lasts seconds | The server closes the channel; the reason is in the handshake or the last message |
Message recording setting
Messages are recorded while “Settings” → “Proxy” → “WebSocket recording” is on, which it is by default. To keep the content readable, Bench doesn’t offer the server message compression. The app works as usual.
With recording off, the connection still shows up in the list with status 101, but without messages. The setting takes effect the next time the proxy starts: click “Stop” and then “Start”.
Limits
- Up to 1000 messages and 4 MB are saved per connection, up to 16 KB per message. Bench counts what didn’t fit and says so in the summary.
- Messages are deleted together with their exchange when old traffic is cleaned up.
- Mocks and breakpoints don’t apply to WebSockets: Bench shows the stream but doesn’t change it.
- A connection to a host that isn’t recorded isn’t decrypted, and its messages aren’t visible.
What you get
The “the server didn’t send it” versus “the app didn’t show it” argument is settled with one look at the list: the down arrow is either there or not. Debugging starts from a fact, not a guess.
Open your app’s WebSocket in beta 0.9.6 and write to beta@microkoi.com about what you missed while reading the messages. We read every email.