Dela via


HubConnectionExtensions.StreamAsChannelCoreAsync<TResult> Method

Definition

Invokes a streaming hub method on the server using the specified method name, return type and arguments.

public static System.Threading.Tasks.Task<System.Threading.Channels.ChannelReader<TResult>> StreamAsChannelCoreAsync<TResult> (this Microsoft.AspNetCore.SignalR.Client.HubConnection hubConnection, string methodName, object[] args, System.Threading.CancellationToken cancellationToken = default);
public static System.Threading.Tasks.Task<System.Threading.Channels.ChannelReader<TResult>> StreamAsChannelCoreAsync<TResult> (this Microsoft.AspNetCore.SignalR.Client.HubConnection hubConnection, string methodName, object?[] args, System.Threading.CancellationToken cancellationToken = default);
static member StreamAsChannelCoreAsync : Microsoft.AspNetCore.SignalR.Client.HubConnection * string * obj[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Threading.Channels.ChannelReader<'Result>>
<Extension()>
Public Function StreamAsChannelCoreAsync(Of TResult) (hubConnection As HubConnection, methodName As String, args As Object(), Optional cancellationToken As CancellationToken = Nothing) As Task(Of ChannelReader(Of TResult))

Type Parameters

TResult

The return type of the streaming server method.

Parameters

hubConnection
HubConnection

The hub connection.

methodName
String

The name of the server method to invoke.

args
Object[]

The arguments used to invoke the server method.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

Task<ChannelReader<TResult>>

A Task<TResult> that represents the asynchronous invoke. The Result property returns a ChannelReader<T> for the streamed hub method values.

Applies to