ChromeDevTools / devtools-protocol

Chrome DevTools Protocol
https://chromedevtools.github.io/devtools-protocol/
BSD 3-Clause "New" or "Revised" License
1.15k stars 226 forks source link

Is there a way to block websocket traffic? #147

Closed mrzealot closed 4 years ago

mrzealot commented 5 years ago

I'm driving Chromium from puppeteer but this seems like a more fundamental issue (as I could naturally circumvent a puppeteer API limitation by using raw DevTools protocol). My problem is that when a webpage initiates a WebSocket connection, the initial request (before the upgrade) doesn't show up as a requestIntercepted event for me (which I'd be able to block as usual), only as a webSocketCreated event, or a webSocketWillSendHandshakeRequest event, neither of which is cancelable afaik.

So (as the title says), is there a way to block (or even intercept or modify) websocket traffic on the protocol level? If not, could you maybe suggest a workaround? Thanks!

TimvdLippe commented 4 years ago

This repository is related to Chrome DevTools Protocol, but does not track issues regarding its definition or implementation. If you want to file an issue for the Chrome DevTools Protocol, please open an issue on https://crbug.com under component: Platform>DevTools>Platform. Thanks in advance!