How do you inspect websocket traffic with Chrome Developer Tools? [duplicate]

无人久伴 提交于 2019-11-27 02:29:17

问题


This question already has an answer here:

  • How to inspect WebSocket frames in Chrome properly? 2 answers

I'm trying to inspect websocket traffic using Chrome Developer Tools. From my research it seems you should be able to see it using the network tab - and it even has a filter for 'ws'.

However I've been inspecting sites that I know are using websockets and can't find a way to inspect the messages being sent back and forth. Using Chrome v56, also tried Safari with no luck...

Does anyone know how this can be achieved?


回答1:


You need to reload the page with the network tab open and filter by type 'ws'. This will show you a connection being made with a websocket. You can then click on the connection to show the traffic being sent back and forth with on the server

https://developers.google.com/web/tools/chrome-devtools/network-performance/reference#frames




回答2:


Information about this traffic is nested deeper in Network tab. Using Chrome 58+, you will see entry about connection to the websocket, on the main Network tab listing.

This change a protocol (HTTP status 101),

so

every possible next request being websocket traffic, will be visible under Frames tab of above entry.

Of course you can have more opened connections to different websockets, aggregated on the main "Network" tab by websocket type.



来源:https://stackoverflow.com/questions/43081107/how-do-you-inspect-websocket-traffic-with-chrome-developer-tools

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!