uber-archive / multitransport-jsonrpc

JSON-RPC Client (Node.js & Browser) and Server (Node.js) aim at "natural looking" server and client code.
116 stars 22 forks source link

Add compressed (gzip) support to the childProcess RPC mechanism #68

Closed dfellis closed 9 years ago

dfellis commented 9 years ago

Will add tests, soon. This just confirms that I didn't break anything at the moment. :)

cc @miloconway

miloconway commented 9 years ago

oh i see

miloconway commented 9 years ago

One feature I would ask for is the ability to control compression on a per-message level that way users can leverage compression on critical sections. Otherwise LGTM.

dfellis commented 9 years ago

@miloconway I'd basically have to reinvent HTTP to provide that sort of header. Content-Encoding: gzip

A portion of the IPC that's in plain text and then the rest is either plain text or gzipped.

Would like to avoid that if possible -- what were you thinking of using it for?

miloconway commented 9 years ago

@dfellis basically if I have lots of small messages I would not necessarily want to incur the cost of compression for them. Otherwise, as a user, I would have to establish two transports, one with compression configured and the other not.

dfellis commented 9 years ago

Okay. What sort of API are you looking for? Presumably you don't want to also serialize every message to check it's length and then serialize it again inside of this library.

Would there be some sort of threshold on size you provide? Or do you want a mechanism to call the method in compression mode? Or set a flag on the transport that the next request is to be compressed?

Right now you guys are the primary consumer, especially for the IPC transport. :)

miloconway commented 9 years ago

I think a size threshold in the options would work best - it would have the smallest impact on the library's API and would be the primary metric we would use to determine whether we want to compress or not.

miloconway commented 9 years ago

Other than some sections of duplicate code that seems good for refactor, LGTM!

dfellis commented 9 years ago

@miloconway published as 0.9.0 :)