Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.
MentorHubClient class
Typed wrapper around HubConnection for the Novior.MentorAgent.Server hub. Manages connection lifecycle with automatic exponential-backoff reconnect.
On this page
Definition
Section titled “Definition”Namespace: Novior.MentorAgent.Blazor.Hub. Package: Novior.MentorAgent.Blazor.
public sealed class MentorHubClient : IAsyncDisposable
dotnet add package Novior.MentorAgent.BlazorConstructors
Section titled “Constructors”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.
Properties
Section titled “Properties”ConnectionId
Section titled “ConnectionId”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.
IsConnected
Section titled “IsConnected”public bool IsConnected { get; }
Methods
Section titled “Methods”CancelRequestAsync
Section titled “CancelRequestAsync”public Task CancelRequestAsync(CancellationToken ct = default)
DisposeAsync
Section titled “DisposeAsync”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)
ResetSessionAsync
Section titled “ResetSessionAsync”public Task ResetSessionAsync(CancellationToken ct = default)
RespondToApprovalAsync
Section titled “RespondToApprovalAsync”public Task RespondToApprovalAsync(string requestId, bool approved, CancellationToken ct = default)
SendMessageAsync
Section titled “SendMessageAsync”public Task SendMessageAsync(string text, CancellationToken ct = default)
public Task SendMessageAsync(string text, IReadOnlyList<MentorAttachment>? attachments, CancellationToken ct = default)
SendUserMessageAsync
Section titled “SendUserMessageAsync”public Task SendUserMessageAsync(MentorUserMessage message, CancellationToken ct = default)
Sends a user turn with its images and its language, to the hub's SendUserMessage.
StartAsync
Section titled “StartAsync”public Task StartAsync(CancellationToken ct = default)
UpdatePageContextAsync
Section titled “UpdatePageContextAsync”public Task UpdatePageContextAsync(PageContextSnapshot snapshot, CancellationToken ct = default)
