Dela via


HubConnection.InvokeCoreAsync Method

Definition

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

public virtual System.Threading.Tasks.Task<object?> InvokeCoreAsync(string methodName, Type returnType, object?[] args, System.Threading.CancellationToken cancellationToken = default);
public System.Threading.Tasks.Task<object> InvokeCoreAsync(string methodName, Type returnType, object[] args, System.Threading.CancellationToken cancellationToken = default);
abstract member InvokeCoreAsync : string * Type * obj[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
override this.InvokeCoreAsync : string * Type * obj[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
member this.InvokeCoreAsync : string * Type * obj[] * System.Threading.CancellationToken -> System.Threading.Tasks.Task<obj>
Public Overridable Function InvokeCoreAsync (methodName As String, returnType As Type, args As Object(), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)
Public Function InvokeCoreAsync (methodName As String, returnType As Type, args As Object(), Optional cancellationToken As CancellationToken = Nothing) As Task(Of Object)

Parameters

methodName
String

The name of the server method to invoke.

returnType
Type

The return type of the server method.

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

A Task<TResult> that represents the asynchronous invoke. The Result property returns an Object for the hub method return value.

Remarks

This is a low level method for invoking a hub method on the server. Using an HubConnectionExtensionsInvokeAsync extension method is recommended.

Applies to