Inspect WebSocket frames in the Network panel
Read the messages sent and received on a WebSocket in Chrome DevTools by filtering the Network panel to WS and opening the Messages tab.
A WebSocket has no request and response, only a stream of frames, so the console shows nothing by itself. The Network panel records every frame.
const ws = new WebSocket("wss://echo.example.test");
ws.addEventListener("open", () => ws.send(JSON.stringify({ type: "ping" })));
ws.addEventListener("message", (e) => console.log(e.data));Open Network, click the WS filter, reload so the connection is recorded, and select the socket. The Messages tab lists the frames: an up arrow in green for sent data and a down arrow in red for received data, each with its length and time. For this echo server:
↑ {"type":"ping"}
↓ {"type":"ping"}Click a frame to read its full text. The tab also filters frames by text and, for binary frames, shows them as opcode and length. See Inspect WebSocket messages.
The panel must be open before the socket connects, or you will not see the earlier frames, which is why the reload matters. The Messages tab does not edit or resend frames, so use a client tool for that.
Frames may hold tokens or personal data, so be careful with screenshots.