Open dominictarr opened 9 years ago
I don't know. I'm a bit sceptical to use streams in the browser - you generally don't need the backpressure stuff, so you can often quite easily use something else. Adding streams support in here would mean that browserifying this would include the full readable-stream
implementation...
Wouldn't it be doable to have a separate module, extending this, that adds streams - like you did with https://github.com/dominictarr/rpc-with-streams?
this module can be more than limited to browsers as clients
I do not remember writing that!
@juliangruber good point. you could have require("rpc-http/no-stream")
and get a browserified version without streams. Or you could use just use classic streams, which are way simpler.
Alright, I'm convinced. Let's go with streams. @dominictarr I like the require("rpc-http/no-stream")
approach.
most node apis have a mix of streams and async functions. So, rpc needs to have remote procedure calls and multiplexing. or if you use http, then it needs streams at least.
To this end, I recently created this, https://github.com/dominictarr/muxrpc to be used as part of secure-scuttlebutt.
Like rpc-http, it just takes a list of method names, except it takes multiple lists, to support both async calls and streams. so far muxrpc has async and source (readable) streams, because that is all I have needed so far. I plan to add sink (writable) later.
would you take a pull request that added streams to rpc-http in a compatible way?