Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Web Inspector Web Socket Debugging

I can use the Network tab in the Google Chrome Web Inspector to debug the network traffic (AJAX requests, etc.). I can check what data is transferred easily. But Websocket connections only show as

Request URL:ws://localhost/... Request Method:GET Status Code:101 Switching Protocols ... 

and I can't see the transferred data. Is there any build in feature in Google Chrome to inspect the transferred data? Or do I need to use Wireshark?

PS: I'm using the latest stable version (16.0.912.75). If a newer version (beta/dev) has this features, it would be nice.

like image 263
Fox32 Avatar asked Jan 21 '12 11:01

Fox32


People also ask

How do I check debugging in Chrome?

The Chrome Web Inspector and Debugger are conveniently built-in with Chrome. You can launch it by hitting F12 while in your browser or by right clicking on a web page and selecting the Inspect menu item. The images below show a few different views that you'll see in the Chrome DevTools browser.


2 Answers

Chrome and Chromium now have WebSocket message frame inspection. Here are the steps to test it quickly:

  1. Navigate to the WebSocket Echo demo, hosted on the websocket.org site.
  2. Turn on the Chrome Developer Tools.
  3. Click Network, enable filter (3rd icon from the left on the top of Dev Tools) to filter the traffic shown by the Developer Tools, and click WebSockets.
  4. In the Echo demo, click Connect. On the Headers tab in Google Dev Tool you can inspect the WebSocket handshake.
  5. Click the Send button in the Echo demo.
  6. To see the WebSocket frames in Chrome Developer Tools, under Name, click the entry representing your WebSocket connection. This refreshes the main panel on the right and makes the WebSocket Frames tab show up with the actual WebSocket message content.

I also posted the steps with screen shots and video. enter image description here

like image 102
Peter Moskovits Avatar answered Sep 25 '22 09:09

Peter Moskovits


After some more research I found a duplicate question here: Debugging WebSocket in Google Chrome

Chrome does't support viewing the traffic in the current stable version. I need to use Wireshark.

like image 23
Fox32 Avatar answered Sep 22 '22 09:09

Fox32