Skip to content

Instantly share code, notes, and snippets.

@auchenberg
Last active September 30, 2016 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save auchenberg/b3a07edc242c4c91a31ddaa2e76d832d to your computer and use it in GitHub Desktop.
Save auchenberg/b3a07edc242c4c91a31ddaa2e76d832d to your computer and use it in GitHub Desktop.
var WebSocket = require('ws');
lastId = 1;
var ws = new WebSocket('ws://localhost:9222/devtools/page/1');
ws.on('error',function(error) {
console.log('error', error);
});
ws.on('message', function(message) {
var msg = JSON.parse(message)
console.log(msg)
});
function send(method, data) {
var req = {
method: method,
params: data,
id: lastId
}
ws.send(JSON.stringify(req));
lastId++;
}
ws.on('open', function(err) {
send('Inspector.enable')
send('Debugger.enable')
send('Debugger.setPauseOnExceptions', {
state: 'none'
})
send('Debugger.setBreakpointsActive', {
active: true // Tada! 🎉🎉🎉
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment