node/NodeWebSocketTransport.ts

puppeteer · packages/puppeteer-core/src/node/NodeWebSocketTransport.ts · typescript · Apache-2.0
scraping

WebSocket transport implementation for Puppeteer, handling keep-alive and message limits.

// Source: https://github.com/puppeteer/puppeteer | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * @license
 * Copyright 2018 Google Inc.
 * SPDX-License-Identifier: Apache-2.0
 */
import NodeWebSocket from 'ws';

import type {ConnectionTransport} from '../common/ConnectionTransport.js';
import {DEBUG_PREFIXES, type Logger} from '../common/Debug.js';
import {packageVersion} from '../util/version.js';

/**
 * How often to ping the browser when keep-alive is enabled, and how long to
 * wait for the matching pong before treating the connection as dead.
 *
 * @internal
 */
export const DEFAULT_KEEP_ALIVE_INTERVAL_MS = 30_000;

/**
 * Largest message accepted from the browser unl

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key