MentorAgent Docs
Menu

Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.

ReferencePackage: Novior.MentorAgent.Blazor

MentorHubClient class

Typed wrapper around HubConnection for the Novior.MentorAgent.Server hub. Manages connection lifecycle with automatic exponential-backoff reconnect.

On this page

Namespace: Novior.MentorAgent.Blazor.Hub. Package: Novior.MentorAgent.Blazor.

public sealed class MentorHubClient : IAsyncDisposable

Terminal
dotnet add package Novior.MentorAgent.Blazor

public MentorHubClient(MentorAgentBlazorOptions options, ILogger<MentorHubClient> logger)

Connects to MentorAgentBlazorOptions.HubUrl as written. A relative HubUrl is not resolved here: use the constructor that takes the NavigationManager, which AddMentorAgentBlazor() picks in WebAssembly.

public MentorHubClient(MentorAgentBlazorOptions options, NavigationManager navigation, ILogger<MentorHubClient> logger)

Connects to MentorAgentBlazorOptions.HubUrl, resolving a relative value such as the default "/mentor-hub" against the page's base address, as a browser does.

public string? ConnectionId { get; }

Id of the live SignalR connection, or null when disconnected. Needed by the out-of-band HTTP endpoints (/mentor/cancel) that must reach this connection's orchestrator without going through the hub.

public bool IsConnected { get; }

public Task CancelRequestAsync(CancellationToken ct = default)

public ValueTask DisposeAsync()

public IDisposable On<T>(string methodName, Action<T?> handler)

public IDisposable On(string methodName, Action handler)

public IDisposable On<T1, T2>(string methodName, Action<T1?, T2?> handler)

public IDisposable On<T1, T2, T3>(string methodName, Action<T1?, T2?, T3?> handler)

public Task ResetSessionAsync(CancellationToken ct = default)

public Task RespondToApprovalAsync(string requestId, bool approved, CancellationToken ct = default)

public Task SendMessageAsync(string text, CancellationToken ct = default)

public Task SendMessageAsync(string text, IReadOnlyList<MentorAttachment>? attachments, CancellationToken ct = default)

public Task SendUserMessageAsync(MentorUserMessage message, CancellationToken ct = default)

Sends a user turn with its images and its language, to the hub's SendUserMessage.

public Task StartAsync(CancellationToken ct = default)

public Task UpdatePageContextAsync(PageContextSnapshot snapshot, CancellationToken ct = default)