dev-resources.site
for different kinds of informations.
How to disconnect WebSocket from Chrome Developer tool
Published at
11/13/2024
Categories
websocket
chrome
Author
Akira
Sometimes, you may need to test how your application behaves when a WebSocket connection is disconnected. Here’s a step-by-step guide to disconnecting a WebSocket via the Chrome Console.
First, enter queryObjects(WebSocket)
in the Chrome Console to retrieve the WebSocket object.
Next, right-click on the WebSocket object, select Store as global variable
from the modal that appears.
This action will store the WebSocket object in a temporary variable, typically named temp1
.
Finally, to close the WebSocket connection, use the command temp1.close()
. This will disconnect the WebSocket, allowing you to observe your application’s response to the disconnection.
Featured ones: