Class WebSocketDeviceConnection
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
socketWebSocketremoteAddressstringoptionsWebSocketDeviceOptions
Properties
RemoteAddress
Gets the address the connection reached, when the transport can report it.
public string? RemoteAddress { get; }
Property Value
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
cancellationTokenCancellationToken
Returns
SendAsync(DeviceFrame, CancellationToken)
Sends one frame.
public ValueTask SendAsync(DeviceFrame frame, CancellationToken cancellationToken = default)
Parameters
frameDeviceFramecancellationTokenCancellationToken