Closed kumavis closed 6 years ago
my usecase is to be able to make a request a stream results back
I've thought about this a lot and I don't think it's a good idea. You could do it, you could also do something similar with async iterators, but they both suffer from the same problem which is that you're incurring a round trip to request each chunk.
If you're going to do this, it's actually a lot better to use a stream multiplexer like https://www.npmjs.com/package/multiplex and then just use one of the sub-streams for the RPC channel. You could even use znode to signal sending the new stream sub-stream.
would be really neat to be able to return a stream as the result of an rpc call