HTTP API Toolkit HTTP API Toolkit
HTTP API Toolkit HTTP API Toolkit
DocFX + Singulink = ♥

Search Results for

    Class ApiHubConnection

    A hub connection that exposes a strongly typed API based on HubMessage, HubMethod<TResult> and HubStream<TItem> definitions, and reports errors from the server as ApiException instances (matching the behavior of regular API requests).

    Inheritance
    object
    ApiHubConnection
    Implements
    IAsyncDisposable
    Namespace: Singulink.Net.Http.Api.Client
    Assembly: Singulink.Net.Http.Api.Client.SignalR.dll
    Syntax
    public sealed class ApiHubConnection : IAsyncDisposable
    Remarks

    Errors are reported as ApiException instances when the server uses the API exception hub filter; other hub errors are reported as HubException instances as usual. Errors that close the connection (e.g. thrown while connecting) are reported via Closed.

    Constructors

    Name Description
    ApiHubConnection(HubConnection)

    Initializes a new instance of the ApiHubConnection class that wraps the specified connection.

    Properties

    Name Description
    ConnectionId

    Gets the connection ID, or null if the connection is not established.

    State

    Gets the current state of the connection.

    UnderlyingConnection

    Gets the underlying HubConnection. Intended for advanced scenarios not covered by the typed API; errors from direct use of the underlying connection are not translated to ApiException instances.

    Methods

    Name Description
    DisposeAsync()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.

    InvokeAsync(HubMessage, CancellationToken)

    Sends a message to the server and waits for the server to finish processing it.

    InvokeAsync<T1>(HubMessage<T1>, T1, CancellationToken)

    Sends a message to the server and waits for the server to finish processing it.

    InvokeAsync<TResult>(HubMethod<TResult>, CancellationToken)

    Invokes a method on the server and returns its result.

    InvokeAsync<T1, T2>(HubMessage<T1, T2>, T1, T2, CancellationToken)

    Sends a message to the server and waits for the server to finish processing it.

    InvokeAsync<T1, TResult>(HubMethod<T1, TResult>, T1, CancellationToken)

    Invokes a method on the server and returns its result.

    InvokeAsync<T1, T2, T3>(HubMessage<T1, T2, T3>, T1, T2, T3, CancellationToken)

    Sends a message to the server and waits for the server to finish processing it.

    InvokeAsync<T1, T2, TResult>(HubMethod<T1, T2, TResult>, T1, T2, CancellationToken)

    Invokes a method on the server and returns its result.

    InvokeAsync<T1, T2, T3, T4>(HubMessage<T1, T2, T3, T4>, T1, T2, T3, T4, CancellationToken)

    Sends a message to the server and waits for the server to finish processing it.

    InvokeAsync<T1, T2, T3, TResult>(HubMethod<T1, T2, T3, TResult>, T1, T2, T3, CancellationToken)

    Invokes a method on the server and returns its result.

    On(HubMessage, Action)

    Registers a handler that is invoked when the server sends the message.

    On(HubMessage, Func<Task>)

    Registers a handler that is invoked when the server sends the message.

    On<T1>(HubMessage<T1>, Action<T1>)

    Registers a handler that is invoked when the server sends the message.

    On<T1>(HubMessage<T1>, Func<T1, Task>)

    Registers a handler that is invoked when the server sends the message.

    On<TResult>(HubMethod<TResult>, Func<Task<TResult>>)

    Registers a handler that is invoked when the server invokes the method, returning the result to the server.

    On<TResult>(HubMethod<TResult>, Func<TResult>)

    Registers a handler that is invoked when the server invokes the method, returning the result to the server.

    On<T1, T2>(HubMessage<T1, T2>, Action<T1, T2>)

    Registers a handler that is invoked when the server sends the message.

    On<T1, T2>(HubMessage<T1, T2>, Func<T1, T2, Task>)

    Registers a handler that is invoked when the server sends the message.

    On<T1, TResult>(HubMethod<T1, TResult>, Func<T1, Task<TResult>>)

    Registers a handler that is invoked when the server invokes the method, returning the result to the server.

    On<T1, TResult>(HubMethod<T1, TResult>, Func<T1, TResult>)

    Registers a handler that is invoked when the server invokes the method, returning the result to the server.

    On<T1, T2, T3>(HubMessage<T1, T2, T3>, Action<T1, T2, T3>)

    Registers a handler that is invoked when the server sends the message.

    On<T1, T2, T3>(HubMessage<T1, T2, T3>, Func<T1, T2, T3, Task>)

    Registers a handler that is invoked when the server sends the message.

    On<T1, T2, TResult>(HubMethod<T1, T2, TResult>, Func<T1, T2, Task<TResult>>)

    Registers a handler that is invoked when the server invokes the method, returning the result to the server.

    On<T1, T2, TResult>(HubMethod<T1, T2, TResult>, Func<T1, T2, TResult>)

    Registers a handler that is invoked when the server invokes the method, returning the result to the server.

    On<T1, T2, T3, T4>(HubMessage<T1, T2, T3, T4>, Action<T1, T2, T3, T4>)

    Registers a handler that is invoked when the server sends the message.

    On<T1, T2, T3, T4>(HubMessage<T1, T2, T3, T4>, Func<T1, T2, T3, T4, Task>)

    Registers a handler that is invoked when the server sends the message.

    On<T1, T2, T3, TResult>(HubMethod<T1, T2, T3, TResult>, Func<T1, T2, T3, Task<TResult>>)

    Registers a handler that is invoked when the server invokes the method, returning the result to the server.

    On<T1, T2, T3, TResult>(HubMethod<T1, T2, T3, TResult>, Func<T1, T2, T3, TResult>)

    Registers a handler that is invoked when the server invokes the method, returning the result to the server.

    SendAsync(HubMessage, CancellationToken)

    Sends a message to the server without waiting for the server to process it.

    SendAsync<T1>(HubMessage<T1>, T1, CancellationToken)

    Sends a message to the server without waiting for the server to process it.

    SendAsync<T1, T2>(HubMessage<T1, T2>, T1, T2, CancellationToken)

    Sends a message to the server without waiting for the server to process it.

    SendAsync<T1, T2, T3>(HubMessage<T1, T2, T3>, T1, T2, T3, CancellationToken)

    Sends a message to the server without waiting for the server to process it.

    SendAsync<T1, T2, T3, T4>(HubMessage<T1, T2, T3, T4>, T1, T2, T3, T4, CancellationToken)

    Sends a message to the server without waiting for the server to process it.

    StartAsync(CancellationToken)

    Starts the connection.

    StopAsync(CancellationToken)

    Stops the connection.

    StreamAsync<TItem>(HubStream<TItem>, CancellationToken)

    Invokes a streaming method on the server and returns the streamed items. The stream is started when enumeration begins and is cancelled when the enumeration is disposed or the cancellation token is cancelled.

    StreamAsync<T1, TItem>(HubStream<T1, TItem>, T1, CancellationToken)

    Invokes a streaming method on the server and returns the streamed items. The stream is started when enumeration begins and is cancelled when the enumeration is disposed or the cancellation token is cancelled.

    StreamAsync<T1, T2, TItem>(HubStream<T1, T2, TItem>, T1, T2, CancellationToken)

    Invokes a streaming method on the server and returns the streamed items. The stream is started when enumeration begins and is cancelled when the enumeration is disposed or the cancellation token is cancelled.

    StreamAsync<T1, T2, T3, TItem>(HubStream<T1, T2, T3, TItem>, T1, T2, T3, CancellationToken)

    Invokes a streaming method on the server and returns the streamed items. The stream is started when enumeration begins and is cancelled when the enumeration is disposed or the cancellation token is cancelled.

    Events

    Name Description
    Closed

    Occurs when the connection is closed. The exception (if any) that caused the connection to close is provided as the argument.

    Reconnected

    Occurs when the connection successfully reconnects. The new connection ID is provided as the argument.

    Reconnecting

    Occurs when the connection starts reconnecting after losing its underlying connection. The exception (if any) that caused the connection to be lost is provided as the argument.

    © Singulink. All rights reserved.