Comments (11)
Extensions have a nice API for that - chrome.debugger . So, if you want to call Debugger.enable()
you can do it like so:
chrome.debugger.attach({
tabId: tabId
}, '1.1', () => {
if (chrome.runtime.lastError) {
// oh no!
}
// we are good
});
chrome.debugger.sendCommand({
tabId: tabId
}, 'Debugger.enable', {}, (response) => {
if (response.error) {
// oh no!
}
// we are good
});
As for everything else (electron app, node, etc.) you have to run chrome with debugging port exposed (--remote-debugging-port=9222
flag). Go to the http://localhost:9222/json
and grab web socket url for the tab that you'd like to debug. Connect to that socket and start sending commands e.g.
var ws = new WebSocket('ws://localhost:9222/devtools/page/123')
ws.onmessage = msg => console.log(JSON.parse(msg.data));
ws.send('{"id":1,"method":"Debugger.enable"}')
@paulirish WDYT about putting some examples/useful links for people who want to play with remote debugging protocol in the Readme.md ? Or maybe even put that on the main page - https://chromedevtools.github.io/debugger-protocol-viewer/ ?
from debugger-protocol-viewer.
and there is no js lib for all that--you have to send raw sockets messages?
..as for the Chrome extension, do they have APIs for everything you can do over sockets, and if not can you use sockets in the the chrome extension?
I imagine a library with your amazingly-documented interface available in both places as the goal here.
from debugger-protocol-viewer.
and there is no js lib for all that--you have to send raw sockets messages?
Using a raw websocket connection is not that complex, but if you prefer a nodejs library check out chrome-remote-interface.
..as for the Chrome extension, do they have APIs for everything you can do over sockets, and if not can you use sockets in the the chrome extension?
See the docs that I linked. Debugger API provides only attach
/detach
/sendCommand
methods. You can send all commands that are defined by the remote debugging protocol using sendCommand
.
I imagine a library with your amazingly-documented interface available in both places as the goal here.
debugger-protocol-viewer is an attempt to create a better documentation for the protocol.
from debugger-protocol-viewer.
ah, I got it...Still could be great for marketing to have a library you can use in both places. give it a nice splash page et al.
...what about debugging node? Does the protocol that Node-Inspector use to communicate to your node app look the same? How difficult do you see it being to write a converter between the 2, is there 1 to 1 matching with most the commands?
from debugger-protocol-viewer.
Node-Inspector is based on Chrome DevTools, I'm pretty sure they are using Chrome Debugging Protocol. They may have made some adjustments though. If you are curious take a pick under the hood ;)
from debugger-protocol-viewer.
Thanks, you can see exactly what they are doing here:
https://github.com/node-inspector/node-inspector/blob/master/lib/DebuggerAgent.js
and how it matches the API you have documented, but how it is in fact a client of the Node debugger api:
https://nodejs.org/api/debugger.html
Would be nice to abstract all that out, and make the lib I'm talking about so more contribution could occur. I feel like Node Inspector needs to move a lot faster (it's buggy as hell)--perhaps that more has to do with Node itself.
from debugger-protocol-viewer.
Would be nice to abstract all that out, and make the lib I'm talking about so more contribution could occur
That's a nice idea. Feel free to create said library!
I feel like Node Inspector needs to move a lot faster (it's buggy as hell)--perhaps that more has to do with Node itself.
from debugger-protocol-viewer.
as far as debugger web GUIs, do you know any open sources ones using the Chrome Debugging Protocol that are small and not a clone of all dev tools like Node-Inspector? Like, Cloud 9 IDE has their own debugger. I'm wondering if anyone has abstracted just that part out of perhaps Node-Inspector or built their own. Node Inspector is a pretty big project, I'd like to look at something a lot smaller dealing with just the debugging aspects.
from debugger-protocol-viewer.
Closing as this is not a valid issue. If you have any questions regarding the protocol, you can ping me at [email protected]
from debugger-protocol-viewer.
:)
from debugger-protocol-viewer.
chrome.debugger work only inside extensions ?
from debugger-protocol-viewer.
Related Issues (20)
- How can I get the serial number of certificate in Network.securityDetails? HOT 1
- Use GitHub Action to deploy to GitHub Pages HOT 2
- Fix service-worker situation
- Tweak page title to be more useful
- page.setDeviceOrientation is undefine HOT 1
- Migrate to Lighthouse CI 0.4.0 🎉 HOT 1
- Restore URL-based search functionality HOT 1
- Docs are returning 404 HOT 1
- Misleading document
- "DOM.getFlattenedDocument" -- Different results between the same service sites in two different network environments
- can i install a crx chrome extension?
- Include cross-references
- adopt lushnikov's vanilla viewer? HOT 1
- Unclear what `ServiceWorker.startWorker` does and what `scopeURL string` is expected to be
- Unclear project repository/site name and description
- No indication of how website issues are tracked
- Monitoring the protocol section: misleading name
- regie
- ACCOUNT
- REGIONAL INTEL DEFENSE ANALYST, DEPARTMENT OF NATIONAL DEFENSE — PHILIPPINES © 2024 by REGIE A FRANCISCO EDM EDD LPT c JD is licensed under Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from debugger-protocol-viewer.