View Source Gateway Compression
Nostrum supports either the zlib-stream or zstd-stream gateway compression
methods, as documented
here
Most users are fine to leave the gateway_compression configuration option set
to :zlib (default), but users looking for a potential reduction in payload
sizes from the Discord gateway can optionally set :zstd here.
Using :zstd compression
Using :zstd depends on the :ezstd library,
so you will have to add this dependency to your mix.exs file:
defp deps do
[
{:nostrum, ...},
{:ezstd, "~> 1.1"} # new dependency
]
end
:ezstdNIFsSome functionality of
:ezstddepends on Erlang NIFs (Natively Implemented Functions). This means that a proper compiler installation as well as other build tools likegitmay be necessary at the stage where you compile your dependencies.It may be useful to run
mix deps.compilein any build systems to ensure that your application does not need build utilities in the built application image.
Once you have this additional dependency installed in your project, set the
:nostrum, :gateway_compression configuration option to :zstd and Nostrum
should pick up on it.
You will need to run mix deps.get and mix deps.compile to install and
compile the new :ezstd dependency.
Nostrum detection of
:ezstdSince the check for
:ezstdtakes place when you compile Nostrum, you might need to runmix deps.compile --force nostrumto ensure that Nostrum is recompiled and recognises the newly installed:ezstddependency.Not doing this may mean that your compiled Nostrum version is still using dummy handlers that will error out even when
:ezstdis installed.