Skip to content

WsOptions

Namespace: PuppeteerSharp

public class WsOptions

Options for the WebSocket connection to the browser.

Inheritance: object

View source

public const int DefaultKeepAliveIntervalMs = 30000

Default ping period in milliseconds when KeepAlive is enabled.

Value: int

View source

public int? HandshakeTimeout { get; set; }

Time in milliseconds to wait for the WebSocket opening handshake before failing. Without it, connecting to a host that accepts the TCP connection but never answers the upgrade request waits until the operating system gives up.

Value: int?

View source

public Dictionary<string, string> Headers { get; set; }

Headers to use for the web socket connection.

Value: Dictionary<string, string>

View source

public bool KeepAlive { get; set; }

Whether to send WebSocket pings and drop the connection when a pong does not come back within the same interval. Detects a connection that died without a close frame, which otherwise leaves calls hanging until ProtocolTimeout.

Value: bool

Dead-connection detection requires .NET 9 or later. On earlier runtimes, enabling keep-alive only configures the WebSocket keep-alive interval.

View source

public int? KeepAliveIntervalMs { get; set; }

Ping period in milliseconds. Only used when KeepAlive is set. Defaults to DefaultKeepAliveIntervalMs.

Value: int?

View source

Made with love by Dario Kondratiuk