WebSocket connections deselecting in Chrome DevTools Network Viewer - google-chrome

I'm trying to use the Chrome DevTools Network viewer to inspect WebSocket frames. I'm not sure if i've discovered a bug or something i'm doing wrong. Essentially, while inspecting the frames, whenever a new frame is recevied, the Network viewer jumps away/deselects the websocket connection. It is particularly bad when there are "ping" type messages being sent every 5-10 seconds, as this makes it almost impossible to keep the frames tab open.
My Chrome version is 58.0.3029.110 (64-bit)
Steps to reproduce:
Hit F12 to open DevTools
Navigate to http://www.websocket.org/echo.html
Check "Use secure WebSocket (TLS)" and click Connect
In DevTools, goto the Network tab and find the websocket connection for the chat (wss://echo.websocket.org/?encoding=text), select it and view the Frames.
Click Send on the page to send a message.
The "?encoding=text" websocket item in the network list will deselect itself and the frames view is gone!.
Any ideas?

I have found a workaround which you can make use of till this bug gets fixed.
Apply search filter to get the required websocket request alone as the displayed item, now the selected blue bg will get hidden but frames tab will not get closed.
Useful filters:
is:running will show currently active websocket request.
domain:requireddomain.com will filter required domain

Looks like this is a bug, as others have reported the same issue here.

Related

How can I get info about hidden interacionts in chrome network tab?

I'm interested in see how the Aviator casino game works, I took a look to the network tab to figure out which interactions is performing my browser with the webserver but it is not showing any requests, I noticed that at the bottom of the network tab it says like 0/649 requests so, how can I get information about those 649 requests, are they hidden? how this game works?
this is the game https://spribe.co/games/aviator
you might not able to see it in a browser but it uses a websocket with encrypted response back to client.

Not seeing all traffic incoming from a website in the inspector under the network tab?

So when I go to a website like, say https://coinmarketcap.com (that displays the prices of cryptocurrencies), in my Chrome Browser, it looks like I dont see all activity going on in the inspector under the Network tab.
Here is a screenshot to visualize the website:
I see the prices are updated live on the website (without refreshing), but I don't see any activity in the Network inspector.
There is of course activity when I load the page for the first time, but nothing after that even tho the website dynamically updates the prices? My firsts thought was, that it could be fake updates via a JS script on the client-side, but there are many websites I know where you can't see this, so what's going on here? What types of protocols are used to achieve this, because I know that WebSockets and polling (xhr) always shows up.
A screenshot of the network inspector, just be clear what I mean by that (showing traffic for the first 50 ms (loading time) and then nothing afterwards)
It using Web socket, you filter the request by WS and should see the latest ws connection.
Click on it and sees the message for this socket.
it was necessary to use a proxy like burpsuite in order to capture the sockets sent and received by the client / server here is the result it's about 72 request received in a single second
The website you suggested is using Websockets for communication.
To see WebSockets request in WS tab in Network inspector, You will have to open the console first then refresh the page.
The console needs to capture the initial handshakes when communication initializes. So if you open the website first then check the console, you may not find anything in WS.

Disable in Chrome: Active Resource Loading Per-Frame Limit

I'm getting this console notice in Chrome Devtools while developing on localhost:
Active resource loading counts reached a per-frame limit while the tab
was in background. Network requests will be delayed until a previous
loading finishes, or the tab is brought to the foreground. See
https://www.chromestatus.com/feature/5527160148197376 for more details
I tried disabling the "Throttle expensive background timers" flag here but that didn't work. The link provided in the console message doesn't say how to disable/override.
This question might be asking the same thing but I'm not certain.
Does anyone know how to override this setting in Chrome? I'm running Chrome Canary 72.x on Mac.
Via the Chrome team, set Enable Resource Load Throttling to disabled:
chrome://flags/#enable-resource-load-scheduler

Why does Chrome sometimes logs only the preflight request (and not the actual GET) when using CORS?

UPDATE: If I go back to 'All' tab and then back to 'XHR' I see both requests, so I guess it's some kind of chrome bug?
The GET request completes successfully but I cannot inspect the response. This occurs randomly in some of the endpoints of my api.
Firefox always logs the response.
You can always have a better view of the network communication via
chrome://net-internals/#events
Maybe you'll find something blocking it before reaching the dev tools..
On the network tab, you can remove the tick infront of this menu 3rd-party-request

Debugging WebSocket in Google Chrome

Is there a way, or an extension, that lets me watch the "traffic" going through a WebSocket? For debugging purposes I'd like to see the client and server requests/responses.
Chrome developer tools now have the ability to list WebSocket frames and also inspect the data if the frames are not binary.
Process:
Launch Chrome Developer tools
Load your page and initiate the WebSocket connections
Click the Network Tab.
Select the WebSocket connection from the list on the left (it will have status of "101 Switching Protocols".
Click the Messages sub-tab. Binary frames will show up with a length and time-stamp and indicate whether they are masked. Text frames will show also include the payload content.
If your WebSocket connection uses binary frames then you will probably still want to use Wireshark to debug the connection. Wireshark 1.8.0 added dissector and filtering support for WebSockets. An alternative may be found in this other answer.
They seem to continuously change stuff in Chrome, but here's what works right now :-)
First you must click on the red record button or you'll get nothing.
I never noticed the WS before but it filters out the web socket
connections.
Select it and then you can see the Frames (now called Messages) which will show you error messages etc.
Chrome Canary and Chromium now have WebSocket message frame inspection feature. Here are the steps to test it quickly:
Navigate to the WebSocket Echo demo [dead as of 2022], hosted on the websocket.org site https://echo.websocket.events/.ws (run by the company Lob) or you can locally run the Echo Server project.
Turn on the Chrome Developer Tools.
Click Network, and to filter the traffic shown by the Dev Tools, click WebSockets.
In the Echo demo, click Connect. On the Headers tab in Google Dev Tool you can inspect the WebSocket handshake.
Click the Send button in the Echo demo.
THIS STEP IS IMPORTANT: To see the WebSocket frames in the Chrome Developer Tools, under Name/Path, click the echo.websocket.org 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.
Note: Every time you send or receive new messages, you have to refresh the main panel by clicking on the echo.websocket.org entry on the left.
I also posted the steps with screen shots and video.
My recently published book, The Definitive Guide to HTML5 WebSocket, also has a dedicated appendix covering the various inspection tools, including Chrome Dev Tools, Chrome net-internals, and Wire Shark.
If you don't have a page which is accessing the websocket, you can open up the Chrome console and type your JavaScript in:
var webSocket = new WebSocket('ws://address:port');
webSocket.onmessage = function(data) { console.log(data); }
This will open up the web socket so you can see it in the network tab and in the console.
The other answers cover the most common scenario: watch the content of the frames (Developer Tools -> Network tab -> Right click on the websocket connection -> frames).
If you want to know some more informations, like which sockets are currently open/idle or be able to close them you'll find this url useful
chrome://net-internals/#sockets
You have 3 options: Chrome (via Developer Tools -> Network tab), Wireshark, and Fiddler (via Log tab), however they all very basic. If you have very high volume of traffic or each frame is very large, it becomes very difficult to use them for debugging.
You can however use Fiddler with FiddlerScript to inspect WebSocket traffic in the same way you inpect HTTP traffic. Few advantages of this solution are that you can leverage many other functionalities in Fiddler, such as multiple inspectors (HexView, JSON, SyntaxView), compare packets, and find packets, etc.
Please refer to my recently written article on CodeProject, which show you how to Debug/Inspect WebSocket traffic with Fiddler (with FiddlerScript). http://www.codeproject.com/Articles/718660/Debug-Inspect-WebSocket-traffic-with-Fiddler
If you want a better experience, I'd suggest using Postman to debug WebSocket requests. It has been released as a new feature.
https://stackoverflow.com/a/43754722/15988851
I'm just posting this since Chrome changes alot, and none of the answers were quite up to date.
Open dev tools
REFRESH YOUR PAGE (so that the WS connection is captured by the network tab)
Click your request
Click the "Frames" sub-tab
You should see somthing like this:
Chrome developer tools allows to see handshake request which stays pending during the opened connection, but you can't see traffic as far as I know. However you can sniff it for example.
Short answer for Chrome Version 29 and up:
Open debugger, go to the tab "Network"
Load page with websocket
Click on the websocket request with upgrade response from server
Select the tab "Frames" to see websocket frames
Click on the websocket request again to refresh frames
I have used Chrome extension called Simple WebSocket Client v0.1.3 that is published by user hakobera. It is very simple in its usage where it allows opening websockets on a given URL, send messages and close the socket connection. It is very minimalistic.
As for a tool I started using, I suggest firecamp Its like Postman, but it also supports websockets and socket.io.