timostamm / protobuf-ts

Protobuf and RPC for TypeScript
Apache License 2.0
1.05k stars 127 forks source link

Add support for gzip compression #153

Closed arontsang closed 2 years ago

arontsang commented 2 years ago

At present, there is no way to change the binary message before it is sent on the wire (in an extensible way), this makes it impossible to have plug in compressors, like gzip.

https://github.com/grpc/grpc/blob/master/doc/compression.md

timostamm commented 2 years ago

For gRPC-web and Twirp, this is fine. The browser will negotiate the content encoding with the backend.

Is this about gRPC via @grpc/grpc-js?

arontsang commented 2 years ago

That would only work with the server->client messaged, client server wouldn't be compressed.

timostamm commented 2 years ago

That's true, but neither Twirp nor gRPC-web specify a mechanism for request compression. I'm also not aware of a browser API that gives us compression.

If you have a good idea to handle this, I'd say it should be added to the twirp / grpc-web transports.

arontsang commented 2 years ago

Grpc supports per message compression, which would actually solve the problem on the protocol side rather than the transport side.

On Tue, 14 Sep 2021, 23:11 Timo Stamm, @.***> wrote:

That's true, but neither Twirp https://github.com/twitchtv/twirp/blob/main/PROTOCOL.md nor gRPC-web https://github.com/grpc/grpc-web/blob/master/doc/browser-features.md#compression specify a mechanism for request compression. I'm also not aware of a browser API that gives us compression.

If you have a good idea to handle this, I'd say it should be added to the twirp / grpc-web transports.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timostamm/protobuf-ts/issues/153#issuecomment-919245187, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA46MLMP6C3H4DOTRMMSP6DUB5QZLANCNFSM5D5MQ7WA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

timostamm commented 2 years ago

Yes. Everything gRPC is run by @grpc/grpc-js, we're just generating simple clients that delegate to the runtime library. So this would be a job for @grpc/grpc-js. It's a nice library, written in TypeScript.

Closing this. Please reopen if you think something should be done on Twirp or gRPC-web.