Cysharp / MagicOnion

Unified Realtime/API framework for .NET platform and Unity.
MIT License
3.68k stars 417 forks source link

OnRequestBegin/OnRequestEnd -> OnMethodInvoke #750

Closed mayuki closed 3 months ago

mayuki commented 3 months ago

This PR combines two methods into a single method that can be interrupted in processing. IStreamingHubDiagnosticHandler implementation must call invokeMethod.

namespace MagicOnion.Client;

public interface IStreamingHubDiagnosticHandler
{
+    public delegate Task<TResponse> InvokeMethodDelegate<TRequest, TResponse>(int methodId, TRequest value);

+    Task<TResponse> OnMethodInvoke<THub, TRequest, TResponse>(THub hubInstance, int methodId, string methodName, TRequest request, bool isFireAndForget, InvokeMethodDelegate<TRequest, TResponse> invokeMethod);

-    void OnRequestBegin<THub, TRequest>(THub hubInstance, Guid requestId, string methodName, TRequest request, bool isFireAndForget);
-    void OnRequestEnd<THub, TResponse>(THub hubInstance, Guid requestId, string methodName, TResponse response, Exception? exception);

    void OnBroadcastEvent<THub, T>(THub hubInstance, string methodName, T value);
}