Cysharp / MagicOnion

Unified Realtime/API framework for .NET platform and Unity.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Client filter is not triggered for ServerStreamingResult method in services.

licentia88 opened this issue · comments

Hello, thank you for the great library. love using it!

I have a created a client filter to send additional data to the server, like tokens etc and it works just fine for regular service methods that are of type UnaryResult<>
however for ServerStreamingResult services the filter is not triggered

    /// <summary>
    /// Initiates a server streaming operation to asynchronously retrieve a stream of model data in batches.
    /// </summary>
    /// <param name="batchSize">The number of items to retrieve in each batch.</param>
    /// <returns>A task representing the server streaming result containing a stream of model data.</returns>
    public virtual Task<ServerStreamingResult<List<TModel>>> StreamReadAllAsync(int batchSize)
    {
        return Client.StreamReadAllAsync(batchSize);
    }

when a request is made to the server with the above method, filter is not triggered.
I know that magiconion does not support client filter for hubs and I know hubs use streamingResult for base.
is this a bug or it just how magiconion is configured to behave?

I can pass this data to the server WithHeaders option but it's more convenient to use Filters for this purpose.

again thank you for providing this great library.

ClientFilter is a mechanism for MagicOnion's Unary, and does not support other streaming and so on.
This is because StreamingResult is almost equivalent to exposing the gRPC API.