Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Preview] Introduce IStreamingHubDiagnosticHandler #746

Merged
merged 4 commits into from
Mar 21, 2024

Conversation

mayuki
Copy link
Member

@mayuki mayuki commented Mar 21, 2024

This PR introduces an API for diagnosing and tracing the communication of StreamingHub. The API is in preview and may be subject to change in the future.

This API only supports the Source Generator at this moment and you need to set the EnableStreamingHubDiagnosticHandler option to true in the generation options. By setting this option, the StreamingHubDiagnosticHandler property will be added to the generated class, allowing you to set a handler.

namespace MagicOnion.Client;

/// <summary>
/// [Preview] The interface of the handler for StreamingHub diagnostics. This API may change in the future.
/// </summary>
public interface IStreamingHubDiagnosticHandler
{
    /// <summary>
    /// The callback method at the beginning of a Hub method request. This API may change in the future.
    /// </summary>
    void OnRequestBegin<THub, TRequest>(THub hubInstance, Guid requestId, string methodName, TRequest request, bool isFireAndForget);

    /// <summary>
    /// [Preview] The callback method at the end of a Hub method request. This API may change in the future.
    /// </summary>
    void OnRequestEnd<THub, TResponse>(THub hubInstance, Guid requestId, string methodName, TResponse response);

    /// <summary>
    /// [Preview] The callback method when a method of HubReceiver is invoked. This API may change in the future.
    /// </summary>
    void OnBroadcastEvent<THub, T>(THub hubInstance, string methodName, T value);
}

@mayuki mayuki merged commit da8112b into main Mar 21, 2024
3 checks passed
@mayuki mayuki deleted the feature/StreamingHubDiagnosticHandler branch March 21, 2024 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant