Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 722
Lloyd Banks Avatar asked Aug 02 '16 19:08

Lloyd Banks


People also ask

How do I stop WebSockets from disconnecting?

disable the feature "Intensive throttling of Javascript timer wake ups" in Chrome or, 2. change the web-transport inactive-timeout in the client profile to more than 60 seconds. To disable the Chrome feature, key in "chrome://flags" in Chrome URL field, search for "Throttle Javascript timer" and disable the feature.

How do I disable WebSockets in Google Chrome?

When you want to turn off WebSockets, click on the TamperMonkey icon and the toggle switch to enable blocking. Refresh the page. Disable the script when you no longer want to block WebSockets.

When should I close WebSocket connection?

If you are writing a server, you should make sure to send a close frame when the server closes a client connection. The normal TCP socket close method can sometimes be slow and cause applications to think the connection is still open even when it's not.

How do I enable WebSockets in Google Chrome?

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".


1 Answers

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.

like image 65
Kayce Basques Avatar answered Sep 30 '22 06:09

Kayce Basques