You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I looked through the documentation for a bit, but couldn't spot anything that would allow for returning multiple results at different times.
Example usecases for this would be a Node Script that starts multiple async jobs (like starting multiple web requests) and would like to return the result of each job as soon as it is done, without having to wait for each of them to complete.
Example implemententions on the JS side could look like an (async) generator function or a callback that can be called multiple times.
What the C# side of the implementation for the above methods could look like isnt clear to me.
The C# call could possibly provide one (or multiple!?) methods that would be called upon a callback/result.
It's perfectly reasonable if you declare this to be utterly out of scope - in this case, does anyone reading this happen to know of alternative libraries which provide such funcionality?
Thank you for your time either way.
The text was updated successfully, but these errors were encountered:
Unfortunately this library doesn't support the use case you've described. In general it does not support bidirectionality - there's no way to register a callback on the dotnet side and invoke it from Node.js at arbitrary times.
This is because the underlying mechanism for inter-process communication is plain HTTP. An invocation of JS in Node.js is just a vanilla HTTP request - a request from .Net gets a single response from Node.js.
There've been requests for bidirectional mechanisms like websockets, which would allow for your use case, but they have not been implemented.
The only alternative for interop with Node.js that I'm aware of is this fork of Edge.js. It has limitations though, some are explained here.
Alternatively if you are able to run pure JS (no Node.js dependencies), you can use Microsoft's JS interop library.
I looked through the documentation for a bit, but couldn't spot anything that would allow for returning multiple results at different times.
Example usecases for this would be a Node Script that starts multiple async jobs (like starting multiple web requests) and would like to return the result of each job as soon as it is done, without having to wait for each of them to complete.
Example implemententions on the JS side could look like an (async) generator function or a callback that can be called multiple times.
What the C# side of the implementation for the above methods could look like isnt clear to me.
The C# call could possibly provide one (or multiple!?) methods that would be called upon a callback/result.
It's perfectly reasonable if you declare this to be utterly out of scope - in this case, does anyone reading this happen to know of alternative libraries which provide such funcionality?
Thank you for your time either way.
The text was updated successfully, but these errors were encountered: