コード例 #1
0
 /// <summary>
 /// Invokes a streaming hub method on the server using the specified method name, return type and argument.
 /// </summary>
 /// <typeparam name="TResult">The return type of the streaming server method.</typeparam>
 /// <param name="hubConnection">The hub connection.</param>
 /// <param name="methodName">The name of the server method to invoke.</param>
 /// <param name="arg1">The first argument.</param>
 /// <param name="arg2">The second argument.</param>
 /// <param name="arg3">The third argument.</param>
 /// <param name="arg4">The fourth argument.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
 /// <returns>
 /// A <see cref="IAsyncEnumerable{TResult}"/> that represents the stream.
 /// </returns>
 public static IAsyncEnumerable <TResult> StreamAsync <TResult>(this HubConnection hubConnection, string methodName, object arg1, object arg2, object arg3, object arg4, CancellationToken cancellationToken = default)
 {
     return(hubConnection.StreamAsyncCore <TResult>(methodName, new[] { arg1, arg2, arg3, arg4 }, cancellationToken));
 }
コード例 #2
0
 /// <summary>
 /// Invokes a streaming hub method on the server using the specified method name and return type.
 /// </summary>
 /// <typeparam name="TResult">The return type of the streaming server method.</typeparam>
 /// <param name="hubConnection">The hub connection.</param>
 /// <param name="methodName">The name of the server method to invoke.</param>
 /// <param name="cancellationToken">The token to monitor for cancellation requests. The default value is <see cref="CancellationToken.None" />.</param>
 /// <returns>
 /// A <see cref="IAsyncEnumerable{TResult}"/> that represents the stream.
 /// </returns>
 public static IAsyncEnumerable <TResult> StreamAsync <TResult>(this HubConnection hubConnection, string methodName, CancellationToken cancellationToken = default)
 {
     return(hubConnection.StreamAsyncCore <TResult>(methodName, Array.Empty <object>(), cancellationToken));
 }