Class WebSocketConnection
Represents a connection to a WebDriver Bidi remote end.
public class WebSocketConnection
- Inheritance
-
WebSocketConnection
- Inherited Members
Constructors
WebSocketConnection()
Initializes a new instance of the WebSocketConnection class.
public WebSocketConnection()
WebSocketConnection(TimeSpan)
Initializes a new instance of the WebSocketConnection class with a given startup timeout.
public WebSocketConnection(TimeSpan startupTimeout)
Parameters
startupTimeout
TimeSpanThe timeout before throwing an error when starting up the connection.
WebSocketConnection(TimeSpan, TimeSpan)
Initializes a new instance of the WebSocketConnection class with a given startup and shutdown timeout.
public WebSocketConnection(TimeSpan startupTimeout, TimeSpan shutdownTimeout)
Parameters
startupTimeout
TimeSpanThe timeout before throwing an error when starting up the connection.
shutdownTimeout
TimeSpanThe timeout before throwing an error when shutting down the connection.
Properties
BufferSize
Gets the buffer size for communication used by this connection.
public int BufferSize { get; }
Property Value
IsActive
Gets a value indicating whether this connection is active.
public bool IsActive { get; }
Property Value
Methods
CloseClientWebSocket()
Asynchronously closes the client WebSocket.
protected virtual Task CloseClientWebSocket()
Returns
- Task
The task object representing the asynchronous operation.
OnDataReceived(WebSocketConnectionDataReceivedEventArgs)
Raises the DataReceived event.
protected virtual void OnDataReceived(WebSocketConnectionDataReceivedEventArgs e)
Parameters
e
WebSocketConnectionDataReceivedEventArgsThe event args used when raising the event.
OnLogMessage(DevToolsSessionLogMessageEventArgs)
Raises the LogMessage event.
protected virtual void OnLogMessage(DevToolsSessionLogMessageEventArgs e)
Parameters
e
DevToolsSessionLogMessageEventArgsThe event args used when raising the event.
SendData(string)
Asynchronously sends data to the remote end of this connection.
public virtual Task SendData(string data)
Parameters
data
stringThe data to be sent to the remote end of this connection.
Returns
- Task
The task object representing the asynchronous operation.
Start(string)
Asynchronously starts communication with the remote end of this connection.
public virtual Task Start(string url)
Parameters
url
stringThe URL used to connect to the remote end.
Returns
- Task
The task object representing the asynchronous operation.
Exceptions
- TimeoutException
Thrown when the connection is not established within the startup timeout.
Stop()
Asynchronously stops communication with the remote end of this connection.
public virtual Task Stop()
Returns
- Task
The task object representing the asynchronous operation.
Events
DataReceived
Occurs when data is received from this connection.
public event EventHandler<WebSocketConnectionDataReceivedEventArgs> DataReceived
Event Type
LogMessage
Occurs when a log message is emitted from this connection.
public event EventHandler<DevToolsSessionLogMessageEventArgs> LogMessage