Skip to content

Connect to a raw WebSocket

Andrea Cardaci edited this page Jun 22, 2021 · 2 revisions

Connect to a raw WebSocket instead of the currently active tab.

const CDP = require('chrome-remote-interface');

const options = {
    target: 'ws://localhost:9222/devtools/page/683d14ca-1f1e-4e33-957c-61ce0446ac8b'
};

CDP(options, (client) => {
    console.log('Connected!');
    client.close();
}).on('error', (err) => {
    console.error(err);
});