Class WebSocketDeviceConnection

Namespace
ProtoTest.Devices.WebSocket
Assembly
ProtoTest.Devices.WebSocket.dll

One open WebSocket, frames in and out. Public so a hosting integration can wrap its own socket.

public sealed class WebSocketDeviceConnection : IProtoDeviceConnection, IAsyncDisposable
Inheritance
WebSocketDeviceConnection
Implements
Inherited Members
Extension Methods

Constructors

WebSocketDeviceConnection(WebSocket, string?, WebSocketDeviceOptions)

public WebSocketDeviceConnection(WebSocket socket, string? remoteAddress, WebSocketDeviceOptions options)

Parameters

socket WebSocket
remoteAddress string
options WebSocketDeviceOptions

Properties

RemoteAddress

Gets the address the connection reached, when the transport can report it.

public string? RemoteAddress { get; }

Property Value

string

Methods

DisposeAsync()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

public ValueTask DisposeAsync()

Returns

ValueTask

A task that represents the asynchronous dispose operation.

ReceiveAsync(CancellationToken)

Receives the next frame, or null when the device closed the connection.

public ValueTask<DeviceFrame?> ReceiveAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

ValueTask<DeviceFrame?>

SendAsync(DeviceFrame, CancellationToken)

Sends one frame.

public ValueTask SendAsync(DeviceFrame frame, CancellationToken cancellationToken = default)

Parameters

frame DeviceFrame
cancellationToken CancellationToken

Returns

ValueTask