Skip to content

Possible to have different types for IProgress<T> and call result in reflection based callee? #353

@trombipeti

Description

@trombipeti

I try to explain the situation as compactly as possible:

There is an operation that is reading a larger amount of data from an external source, parses it and packs it into a nice structure (say, MyDataStructure). The data arrives slowly, but in "one piece" and not in chunks. However, the progress of the read operation can be figured out. There can be multiple operations of the same kind in progress parallel, however, they always "belong" to a separate source.
I want to expose this operation through WAMP, make it cancelable and also report its progress.

What I though was possible to achieve is the following:
I make a [WampProgressiveResultProcedure], have it return a Task<MyDataStructure>, and accept an IProgress<int> and a CancellationToken as two last parameters. This could then call the method for the operation, and I'd have progress reporting and cancelation automatically.

[WampProgressiveResultProcedure]
[WampProcedure("com.myapp.this_operation")]
public Task<MyDataStructure> ThisOperation(int resourceId, IProgress<int> progress, CancellationToken cancellationToken);

However, it is currently not possible with WampSharp, as apparently:

Note that the method return type should be Task<T> where this is the same T as in the IProgress<T> of the last parameter.

from https://wampsharp.net/wamp2/roles/callee/reflection-based-callee/

For me it is not obvious if it's like this because the spec says so, but I'd assume not as there are no types as such in the WAMP proto afaik.

Would it be possible to have two different Ts for progressive call results?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions