1

I am writing a chrome extension for a website and I want to be able to read the websocket messages being sent to the website in my chrome extension. I can see the data I need using the network tab from chrome developer tools but am not sure how to access it from the extension.

Eric Hong
  • 23
  • 4
  • I think there is nothing more than accessing it through the normal browser API [`WebSocket` (MDN)](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API/Writing_WebSocket_client_applications) or a library such as [Socket.io](https://socket.io/) – DDomen Feb 20 '21 at 00:18
  • Extensions can either override (hook) WebSocket methods in [page context](/a/9517879), here's an [example for XHR](https://stackoverflow.com/a/48134114), or they can use chrome.debugger API with [Network](https://chromedevtools.github.io/devtools-protocol/tot/Network/) CDP events, [example](https://stackoverflow.com/a/29845219) for getting body. – wOxxOm Feb 20 '21 at 06:02
  • Does this answer your question? [access Websocket traffic from chrome extension](https://stackoverflow.com/questions/22868897/access-websocket-traffic-from-chrome-extension) – Dandelion Aug 28 '21 at 12:35

0 Answers0