Chrome - Disabling Web Sockets or Closing a Web Socket Connection?

Is there any way to disable web socket connections or end a web socket connection through Chrome's developer tools network tab?

I've noticed that turning throttling under the network tab to Offline doesn't affect web socket connections that have already been established. It only prevents traditional HTTP requests from going out.

There's a question here related to this, but it's woefully outdated.


February 2022 update

As of Chrome 99 this is supported: https://developer.chrome.com/blog/new-in-devtools-99/#websocket

Original answer

No, there is no way to disable or close a connection from the Network panel. Source: DevTools Engineer.

If you have a reference to the WS connection, though, you can close it via the Console using its JS API.


You can close idle and flush your inactive socket pools in the Net Internals page in Chrome. However, this unfortunately only closes your active sockets by the looks of it.

chrome://net-internals/#sockets

Web Sockets

You would have to use the WebSockets API and call close() on a reference to an existing socket to close it explicitly. Otherwise, killing the process with the active socket is all I can think of.