EDA.Gateway.Encoding.JSON (EDA v0.3.0)

Copy Markdown View Source

JSON encoding for Discord Gateway payloads via Jason.

Text-based format useful for debugging. Payloads are slightly larger than ETF and decoding is slower, but the output is human-readable.

Summary

Functions

Decodes a JSON binary into a map with string keys.

Encodes a map as a JSON text frame.

Returns "json" for the gateway URL query parameter.

Functions

decode(binary)

@spec decode(binary()) :: map()

Decodes a JSON binary into a map with string keys.

encode(map)

@spec encode(map()) :: {:text, binary()}

Encodes a map as a JSON text frame.

url_encoding()

@spec url_encoding() :: String.t()

Returns "json" for the gateway URL query parameter.