View Source Nostrum.Shard.Session.Compression behaviour (Nostrum v0.10.0)

A behaviour for compression methods supported by the Discord gateway to implement.

See the modules nested under this behaviour for reference implementations.

Internal module

This module is intended for exclusive usage inside of nostrum, and is documented for completeness and people curious to look behind the covers.

Summary

Callbacks

Create a new compression context that can be passed as an argument to other methods within the behaviour to inflate data or reset the context to a blank state.

Decompress a frame received from Discord over the gateway. Should return an iolist of the decompressed data.

Reset a decompression context to a blank slate, this is useful after a websocket resume has taken place or something similar requiring the reset of the state for a shard.

Callbacks

@callback create_context() :: reference()

Create a new compression context that can be passed as an argument to other methods within the behaviour to inflate data or reset the context to a blank state.

Link to this callback

inflate(reference, iodata)

View Source
@callback inflate(reference(), iodata()) :: iolist()

Decompress a frame received from Discord over the gateway. Should return an iolist of the decompressed data.

Link to this callback

reset_context(reference)

View Source
@callback reset_context(reference()) :: reference()

Reset a decompression context to a blank slate, this is useful after a websocket resume has taken place or something similar requiring the reset of the state for a shard.