Table of Contents

Class WebSocketConnection

Namespace
OpenQA.Selenium.Safari.Internal
Assembly
WebDriver.dll

Represents a connection to a WebSocket.

public class WebSocketConnection : IWebSocketConnection
Inheritance
WebSocketConnection
Implements
Inherited Members

Constructors

WebSocketConnection(ISocket, string)

Initializes a new instance of the WebSocketConnection class.

public WebSocketConnection(ISocket socket, string parseScheme)

Parameters

socket ISocket

The ISocket used in the connection.

parseScheme string

The scheme used to parse requests.

Properties

ConnectionInfo

Gets an IWebSocketConnectionInfo object describing the connection.

public IWebSocketConnectionInfo ConnectionInfo { get; }

Property Value

IWebSocketConnectionInfo

Handler

Gets or sets the IHandler implementation used for parsing and handling requests.

public IHandler Handler { get; set; }

Property Value

IHandler

Socket

Gets or sets the ISocket implementation used for communication.

public ISocket Socket { get; set; }

Property Value

ISocket

Methods

Close()

Closes the connection.

public void Close()

OnBinaryMessageReceived(BinaryMessageHandledEventArgs)

Fires the BinaryMessageReceived event.

protected void OnBinaryMessageReceived(BinaryMessageHandledEventArgs e)

Parameters

e BinaryMessageHandledEventArgs

A BinaryMessageHandledEventArgs that contains the event data.

OnClose(ConnectionEventArgs)

Fires the Closed event.

protected void OnClose(ConnectionEventArgs e)

Parameters

e ConnectionEventArgs

A ConnectionEventArgs that contains the event data.

OnError(ErrorEventArgs)

Fires the ErrorReceived event.

protected void OnError(ErrorEventArgs e)

Parameters

e ErrorEventArgs

An ErrorEventArgs that contains the event data.

OnMessageReceived(TextMessageHandledEventArgs)

Fires the MessageReceived event.

protected void OnMessageReceived(TextMessageHandledEventArgs e)

Parameters

e TextMessageHandledEventArgs

A TextMessageHandledEventArgs that contains the event data.

OnOpen(ConnectionEventArgs)

Fires the Opened event.

protected void OnOpen(ConnectionEventArgs e)

Parameters

e ConnectionEventArgs

A ConnectionEventArgs that contains the event data.

OnSend(EventArgs)

Fires the Sent event.

protected void OnSend(EventArgs e)

Parameters

e EventArgs

An EventArgs that contains the event data.

OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs)

Fires the StandardHttpRequestReceived event.

protected void OnStandardHttpRequestReceived(StandardHttpRequestReceivedEventArgs e)

Parameters

e StandardHttpRequestReceivedEventArgs

A StandardHttpRequestReceivedEventArgs that contains the event data.

Send(byte[])

Sends a binary message over the connection.

public void Send(byte[] message)

Parameters

message byte[]

The binary message to send.

Send(string)

Sends a text message over the connection.

public void Send(string message)

Parameters

message string

The text message to send.

SendRaw(string)

Sends raw text over the connection, without passing through a handler.

public void SendRaw(string message)

Parameters

message string

The message to send.

StartReceiving()

Starts the connection receiving requests.

public void StartReceiving()

Events

BinaryMessageReceived

Event raised when a binary message is received via the connection.

public event EventHandler<BinaryMessageHandledEventArgs> BinaryMessageReceived

Event Type

EventHandler<BinaryMessageHandledEventArgs>

Closed

Event raised when a connection is closed.

public event EventHandler<ConnectionEventArgs> Closed

Event Type

EventHandler<ConnectionEventArgs>

ErrorReceived

Event raised when an error occurs via the connection.

public event EventHandler<ErrorEventArgs> ErrorReceived

Event Type

EventHandler<ErrorEventArgs>

MessageReceived

Event raised when a text message is received via the connection.

public event EventHandler<TextMessageHandledEventArgs> MessageReceived

Event Type

EventHandler<TextMessageHandledEventArgs>

Opened

Event raised when a connection is opened.

public event EventHandler<ConnectionEventArgs> Opened

Event Type

EventHandler<ConnectionEventArgs>

Sent

Event raised when data is sent via the connection.

public event EventHandler Sent

Event Type

EventHandler

StandardHttpRequestReceived

Event raised when a non-WebSocket message is received.

public event EventHandler<StandardHttpRequestReceivedEventArgs> StandardHttpRequestReceived

Event Type

EventHandler<StandardHttpRequestReceivedEventArgs>