Show / Hide Table of Contents

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 Source

ConnectAndAuthenticateAsync(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.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 Source

Connected

Occurs when stream is successfully connected.

Declaration
event Action<AuthStatus>? Connected
Event Type
Type Description
System.Nullable<Action<AuthStatus>>
| Improve this Doc View Source

OnError

Occurs when any error occurs in stream.

Declaration
event Action<Exception>? OnError
Event Type
Type Description
System.Nullable<Action<Exception>>
| Improve this Doc View Source

OnWarning

Occurs in case of non-critical events.

Declaration
event Action<String>? OnWarning
Event Type
Type Description
System.Nullable<Action<String>>
| Improve this Doc View Source

SocketClosed

Occurs when underlying web socket is successfully closed.

Declaration
event Action? SocketClosed
Event Type
Type Description
System.Nullable<Action>
| Improve this Doc View Source

SocketOpened

Occurs when underlying web socket is successfully opened.

Declaration
event Action? SocketOpened
Event Type
Type Description
System.Nullable<Action>
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX