How to configure CDP message ID generator in Puppeteer?

Puppeteer

The CDP message ID generator can be configured by passing a custom idGenerator to the Connection constructor. This enables sharing the same transport across multiple connections without ID conflicts. The idGenerator option is optional; if omitted, the default generator is used.

Example:

// example optional id generator
const myIdGenerator = (() => {
  let id = 0;
  return () => ++id;
})();

const connection = new Connection(transport, { idGenerator: myIdGenerator });