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 SourceCloseStatus
Gets current web socket channel close status (if any).
Declaration
WebSocketCloseStatus? CloseStatus { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Net.WebSockets.WebSocketCloseStatus> |
State
Gets current web socket channel state.
Declaration
WebSocketState State { get; }
Property Value
Type | Description |
---|---|
System.Net.WebSockets.WebSocketState |
Methods
| Improve this Doc View SourceAbort()
Immediately aborts connection at socket level.
Declaration
void Abort()
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 |
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 |
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). |
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 |