Kraigie / nostrum

Elixir Discord Library
https://kraigie.github.io/nostrum/
MIT License
588 stars 125 forks source link

Support zstd-stream gateway compression #598

Closed jb3 closed 1 month ago

jb3 commented 1 month ago

This adds support for zstd-stream compression through configuration of the :gateway_compression configuration option.

This will optionally use the :ezstd library to decompress received payloads from Discord allowing for some potential savings on payload size.

This also moves the ws_state to be agnostic and references the compression context as compress_ctx instead of the previous zlib_ctx.

We add an optional dependency for :ezstd. I have not made this mandatory as it requires natively built functions and as such I cannot guarantee how cross-platform it is or in what environments it will build.

zstd-stream compression is documented upstream by discord/discord-api-docs#6877.

jchristgit commented 1 month ago

Thanks!