Share via


HubConnection.On Method

Definition

Overloads

On(String, Type[], Func<Object[],Object,Task>, Object)

Registers a handler that will be invoked when the hub method with the specified method name is invoked.

On(String, Type[], Func<Object[],Object,Task<Object>>, Object)

Registers a handler that will be invoked when the hub method with the specified method name is invoked. Returns value returned by handler to server if the server requests a result.

On(String, Type[], Func<Object[],Object,Task>, Object)

Source:
HubConnection.cs
Source:
HubConnection.cs
Source:
HubConnection.cs
Source:
HubConnection.cs
Source:
HubConnection.cs
Source:
HubConnection.cs
Source:
HubConnection.cs
Source:
HubConnection.cs
Source:
HubConnection.cs

Registers a handler that will be invoked when the hub method with the specified method name is invoked.

public:
 IDisposable ^ On(System::String ^ methodName, cli::array <Type ^> ^ parameterTypes, Func<cli::array <System::Object ^> ^, System::Object ^, System::Threading::Tasks::Task ^> ^ handler, System::Object ^ state);
public IDisposable On (string methodName, Type[] parameterTypes, Func<object[],object,System.Threading.Tasks.Task> handler, object state);
public virtual IDisposable On (string methodName, Type[] parameterTypes, Func<object?[],object,System.Threading.Tasks.Task> handler, object state);
member this.On : string * Type[] * Func<obj[], obj, System.Threading.Tasks.Task> * obj -> IDisposable
abstract member On : string * Type[] * Func<obj[], obj, System.Threading.Tasks.Task> * obj -> IDisposable
override this.On : string * Type[] * Func<obj[], obj, System.Threading.Tasks.Task> * obj -> IDisposable
Public Function On (methodName As String, parameterTypes As Type(), handler As Func(Of Object(), Object, Task), state As Object) As IDisposable
Public Overridable Function On (methodName As String, parameterTypes As Type(), handler As Func(Of Object(), Object, Task), state As Object) As IDisposable

Parameters

methodName
String

The name of the hub method to define.

parameterTypes
Type[]

The parameters types expected by the hub method.

handler
Func<Object[],Object,Task>

The handler that will be raised when the hub method is invoked.

state
Object

A state object that will be passed to the handler.

Returns

A subscription that can be disposed to unsubscribe from the hub method.

Remarks

This is a low level method for registering a handler. Using an HubConnectionExtensionsOn extension method is recommended.

Applies to

On(String, Type[], Func<Object[],Object,Task<Object>>, Object)

Source:
HubConnection.cs
Source:
HubConnection.cs
Source:
HubConnection.cs

Registers a handler that will be invoked when the hub method with the specified method name is invoked. Returns value returned by handler to server if the server requests a result.

public virtual IDisposable On (string methodName, Type[] parameterTypes, Func<object?[],object,System.Threading.Tasks.Task<object?>> handler, object state);
abstract member On : string * Type[] * Func<obj[], obj, System.Threading.Tasks.Task<obj>> * obj -> IDisposable
override this.On : string * Type[] * Func<obj[], obj, System.Threading.Tasks.Task<obj>> * obj -> IDisposable
Public Overridable Function On (methodName As String, parameterTypes As Type(), handler As Func(Of Object(), Object, Task(Of Object)), state As Object) As IDisposable

Parameters

methodName
String

The name of the hub method to define.

parameterTypes
Type[]

The parameters types expected by the hub method.

handler
Func<Object[],Object,Task<Object>>

The handler that will be raised when the hub method is invoked.

state
Object

A state object that will be passed to the handler.

Returns

A subscription that can be disposed to unsubscribe from the hub method.

Remarks

This is a low level method for registering a handler. Using an HubConnectionExtensionsOn extension method is recommended.

Applies to