-
Notifications
You must be signed in to change notification settings - Fork 151
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
Add support for passing IObserver<T> objects over RPC #346
Comments
Is the intention here to forward these as Given the power of this project already this enhancement sounds like it may kill the need for some internal gRPC I have in a project that ships to client machines... |
Yes, @bddckr, that's the idea. We already do similar things with We're using this library instead of gRPC for many of our features. |
I'm looking at starting a small project using either this library or GRPC, and subscribing to If I want to return an |
Not yet. The closest thing we have is |
Ok, so best general case currently for me to return multiple values (spread over time) from a remote function is to try piggyback off IProgress - might be doable for my particular use case (single immediate subscriber, just want to get the data back to local machine as it's produced). |
This is in progress in my iobserver branch. |
Awesome. FYI I did get a reliable proxy of |
One question that comes up from this work is what to do about the |
That does sound difficult if you are going for a very general solution where
Assuming you want to support the actual Might as well post what I am using, in case it is any use to you. Apologies for VB.NET but that part of the codebase is in that language. Client side:
Server side:
Other:
|
This is definitely a feature we would be interested in seeing. Our desktop application is built with Rx from the ground up, so that would allow a seemless integration with the server. Very excited to see it made the 2.6 milestone! |
@AArnott A huge thanks for this, it's so good that my team's Rx codebase is basically usable via JSON-RPC in minutes! The project I'm working on hosts a frontend and we'd like to utilize JSON-RPC for the interop between our .NET side and their TypeScript/JS world. We're just doing some good old browser interop as we're realizing this via platform-specific WebView components. I've been looking at vscode-jsonrpc. Looks like it already has support for cancellation and disposables, but observables - or more generally marshalled objects - seem to not be compatible yet. Is that correct? I did notice you seem to have started looking into that already perhaps, according to microsoft/vscode-languageserver-node#661 and microsoft/vscode-languageserver-node#657. Was your intention to get vscode-jsonrpc compliant with the marshalled objects functionality that this .NET library offers now? Any idea on any sort of timeline on that front? Sorry if this is the wrong place to discuss, feel free to forward me elsewhere! And thanks again for your work on all of this. |
I'm so glad to hear it's fitting your requirements, @bddckr. Yes, maintaining interop with vscode-jsonrpc is a high priority, and we're a bit behind on adding this functionality to that library. We may land somewhere between three ends: enhance that library, document how to do it, and/or wrap that library in another that adds functionality. I'm not sure where/when this will be though. It could easily be a few months away. |
That is more than enough info for me and the team, thanks! I do understand the relationship between the two projects, you and the teams involved. This is however giving me a good overview of where things are currently. I'll see what our priorities allow and will definitely be coming back to this repo and/or the vscode-jsonrpc library's repo to raise suggestions (and PRs when we can). |
We might define a protocol by which an
IObservable<T>
property's Subscribe method could be turned into an RPC call to start the remote subscription. We'd then need to define how callbacks from the server regarding that property would be sent.Then the local JsonRpc instance can track the
IObserver<T>
object until the observable's OnError or OnComplete method is called.Also consider supporting
IObserver<T>
being passed as an argument to an RPC method so that the server can take other args that configure exactly what data should be passed to that observer.Prerequisites:
IObserver<T>.OnError(Exception)
).AddLocalRpcTarget<T>
to expose an object, limited to one interface it implements.IObserver<T>
.OnNext(T)`).void
returning methods by sending notifications #522 Dynamic proxies allowvoid
returning methods, implemented as notifications.IDisposable
Tracked internally with https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1146152
The text was updated successfully, but these errors were encountered: