Class
WebSocket

The WebSocket class represents a "tunnel" through which WebSocket messages flow. The class' messages may be deserialized from a SAZ file.

Definition

Constructors

WebSocket(Session, ClientPipe, ServerPipe)

Creates a WebSocket tunnel. External callers instead use the CreateTunnel static method.

Declaration

cs-api-definition
public WebSocket(Session oSess, ClientPipe oFrom, ServerPipe oTo)

Parameters

oSess

Session

The session for which this tunnel was initially created.

oFrom

ClientPipe

The client pipe

oTo

ServerPipe

The server pipe

Fields

WebsocketMessageEncodingRegex

Used to check if there is encoding applied to a WebSocket connection by matching text in response headers

Declaration

cs-api-definition
public static readonly string WebsocketMessageEncodingRegex

Field Value

string

listMessages

Gets the list of captured WebSocket messages

Declaration

cs-api-definition
public List<WebSocketMessage> listMessages

Field Value

List<WebSocketMessage>

Properties

EgressByteCount

Returns number of bytes sent from the Client to the Server on this WebSocket

Declaration

cs-api-definition
public override long EgressByteCount { get; protected set; }

Property Value

long

Overrides BaseTunnel.EgressByteCount

IngressByteCount

Returns number of bytes sent from the Server to the Client on this WebSocket

Declaration

cs-api-definition
public override long IngressByteCount { get; protected set; }

Property Value

long

Overrides BaseTunnel.IngressByteCount

MessageCount

Gets the number of captured WebSocket messages currently

Declaration

cs-api-definition
public int MessageCount { get; }

Property Value

int

Methods

DoCloseTunnelAsync()

Interface Method Close the WebSocket and signal the event to let its service thread die. Also called by oSession.Abort() WARNING: This should not be allowed to throw any exceptions, because it will do so on threads that don't catch them, and this will kill the application.

Declaration

cs-api-definition
public override Task DoCloseTunnelAsync()

Returns

Task

Overrides BaseTunnel.DoCloseTunnelAsync()

StartReceiveFromClient()

Called when we have received data from the local client.

Declaration

cs-api-definition
protected Task StartReceiveFromClient()

Returns

Task

StartReceiveFromServer()

Called when we have received data from the remote host. Incoming data will immediately be forwarded to the local client.

Declaration

cs-api-definition
protected Task StartReceiveFromServer()

Returns

Task

ToString()

Declaration

cs-api-definition
public override string ToString()

Returns

string

Overrides object.ToString()