Chrome debugging WebSocket

var ws = new WebSocket(‘ws://localhost:9222/devtools/page/3c5c05fa-80b7-4cfe-8d1d-ebe79a7a5730’);

ws.onopen= function() {

ws.send(‘{“id”: 1, “method”: “Page.navigate”, “params”: {“url”: “https://www.fangdushi.com”}}’)

};

ws.onmessage = function(evt) {

console.log(‘Received a message from the server!’+evt.data);

};

API documentation address https://chromedevtools.github.io/devtools-protocol/1-2

The post Chrome debugging WebSocket first appeared on Lenix Blog .

This article is reprinted from https://blog.p2hp.com/archives/8911
This site is for inclusion only, and the copyright belongs to the original author.

Leave a Comment