Interface IStreamingClient
Provides unified type-safe access for websocket streaming APIs.
Namespace: Alpaca.Markets
Assembly: Alpaca.Markets.dll
Syntax
public interface IStreamingClient
Methods
| Improve this Doc View SourceConnectAndAuthenticateAsync(CancellationToken)
Opens connection to a streaming API and awaits for authentication response.
Declaration
Task<AuthStatus> ConnectAndAuthenticateAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task<AuthStatus> | Awaitable task object for handling client authentication event in asynchronous mode. |
Exceptions
Type | Condition |
---|---|
System.Net.WebSockets.WebSocketException | The WebSocket connection failed due to an high-level protocol or connection issue. |
ConnectAsync(CancellationToken)
Opens connection to a streaming API.
Declaration
Task ConnectAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task | Awaitable task object for handling action completion in asynchronous mode. |
Exceptions
Type | Condition |
---|---|
System.Net.WebSockets.WebSocketException | The WebSocket connection failed due to an high-level protocol or connection issue. |
DisconnectAsync(CancellationToken)
Closes connection to a streaming API.
Declaration
Task DisconnectAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | A cancellation token that can be used by other objects or threads to receive notice of cancellation. |
Returns
Type | Description |
---|---|
Task | Awaitable task object for handling action completion in asynchronous mode. |
Exceptions
Type | Condition |
---|---|
System.Net.WebSockets.WebSocketException | The WebSocket connection failed due to an high-level protocol or connection issue. |
Events
| Improve this Doc View SourceConnected
Occurs when stream is successfully connected.
Declaration
event Action<AuthStatus>? Connected
Event Type
Type | Description |
---|---|
System.Nullable<Action<AuthStatus>> |
OnError
Occurs when any error occurs in stream.
Declaration
event Action<Exception>? OnError
Event Type
Type | Description |
---|---|
System.Nullable<Action<Exception>> |
OnWarning
Occurs in case of non-critical events.
Declaration
event Action<String>? OnWarning
Event Type
Type | Description |
---|---|
System.Nullable<Action<String>> |
SocketClosed
Occurs when underlying web socket is successfully closed.
Declaration
event Action? SocketClosed
Event Type
Type | Description |
---|---|
System.Nullable<Action> |
SocketOpened
Occurs when underlying web socket is successfully opened.
Declaration
event Action? SocketOpened
Event Type
Type | Description |
---|---|
System.Nullable<Action> |