// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Threading; using System.Threading.Tasks; namespace Microsoft.AspNetCore.SignalR { /// /// Extension methods for . /// public static class ClientProxyExtensions { /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, Array.Empty(), cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The third argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The third argument. /// The fourth argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The third argument. /// The fourth argument. /// The fifth argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The third argument. /// The fourth argument. /// The fifth argument. /// The sixth argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The third argument. /// The fourth argument. /// The fifth argument. /// The sixth argument. /// The seventh argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The third argument. /// The fourth argument. /// The fifth argument. /// The sixth argument. /// The seventh argument. /// The eigth argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The third argument. /// The fourth argument. /// The fifth argument. /// The sixth argument. /// The seventh argument. /// The eigth argument. /// The ninth argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }, cancellationToken); } /// /// Invokes a method on the connection(s) represented by the instance. /// Does not wait for a response from the receiver. /// /// The /// The name of the method to invoke. /// The first argument. /// The second argument. /// The third argument. /// The fourth argument. /// The fifth argument. /// The sixth argument. /// The seventh argument. /// The eigth argument. /// The ninth argument. /// The tenth argument. /// The token to monitor for cancellation requests. The default value is . /// A that represents the asynchronous invoke. public static Task SendAsync(this IClientProxy clientProxy, string method, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8, object arg9, object arg10, CancellationToken cancellationToken = default) { return clientProxy.SendCoreAsync(method, new[] { arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10 }, cancellationToken); } } }