-
Notifications
You must be signed in to change notification settings - Fork 84
Description
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 theIProgress<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 T
s for progressive call results?