Show / Hide Table of Contents

Interface IWebSocket

Encapsulates asynchronous interface of web socket client.

Namespace: Alpaca.Markets
Assembly: Alpaca.Markets.dll
Syntax
public interface IWebSocket

Properties

| Improve this Doc View Source

CloseStatus

Gets current web socket channel close status (if any).

Declaration
WebSocketCloseStatus? CloseStatus { get; }
Property Value
Type Description
System.Nullable<System.Net.WebSockets.WebSocketCloseStatus>
| Improve this Doc View Source

State

Gets current web socket channel state.

Declaration
WebSocketState State { get; }
Property Value
Type Description
System.Net.WebSockets.WebSocketState

Methods

| Improve this Doc View Source

Abort()

Immediately aborts connection at socket level.

Declaration
void Abort()
| Improve this Doc View Source

CloseOutputAsync(WebSocketCloseStatus)

Disconnects web socket channel from endpoint.

Declaration
Task CloseOutputAsync(WebSocketCloseStatus closeStatus)
Parameters
Type Name Description
System.Net.WebSockets.WebSocketCloseStatus closeStatus

Disconnection code.

Returns
Type Description
Task
| Improve this Doc View Source

ConnectAsync(Uri, CancellationToken)

Connects specified endpoint using web socket protocol.

Declaration
Task ConnectAsync(Uri uri, CancellationToken cancellationToken)
Parameters
Type Name Description
Uri uri

The web socket endpoint URL for connection.

CancellationToken cancellationToken

A cancellation token that can be used by other objects or threads to receive notice of cancellation.

Returns
Type Description
Task
| Improve this Doc View Source

ReceiveAsync(Memory<Byte>)

Reads message frame from the web socket into memory.

Declaration
ValueTask<ReceiveResult> ReceiveAsync(Memory<Byte> buffer)
Parameters
Type Name Description
Memory<Byte> buffer

Memory buffer for receiving data.

Returns
Type Description
ValueTask<Alpaca.Markets.ReceiveResult>

Read action status (frame parameters).

| Improve this Doc View Source

SendAsync(ReadOnlySequence<Byte>)

Sends message into the web socket from memory buffer.

Declaration
ValueTask SendAsync(ReadOnlySequence<Byte> buffer)
Parameters
Type Name Description
System.Buffers.ReadOnlySequence<Byte> buffer

Memory buffer with binary message.

Returns
Type Description
ValueTask
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX