ChannelClient.Formats.TOON (channel_client v0.1.0)

Copy Markdown

TOON (Token-Oriented Object Notation) wire format — compact, text-based.

The actual codec is delegated to a library module exposing encode!/1 and decode!/1. The suggested dependency is toon_ex, whose main ToonEx module is the default; because it is not a hard dependency of channel_client, add it to your own deps before using this format:

{:toon_ex, "~> 1.0"}

Frames are atom-keyed maps:

%{join_ref: jr, ref: ref, topic: topic, event: event, payload: payload}

Payloads must be JSON-compatible data (maps, lists, strings, numbers, booleans, nil) since that is what TOON represents. Use the library: option to point at any equivalent module (useful for tests or adapters).

Options

  • :library - codec module, defaults to ToonEx