ToonEx.Phoenix.Serializer (toon_ex v1.1.0)

Copy Markdown View Source

Satisfies the PhoenixClient JSON-parser contract, which requires encode/2, encode!/2, decode/2, decode!/2 and encode_to_iodata!. The optional opts argument is accepted but intentionally ignored so that this module can be dropped in wherever a standard JSON library is expected.

Updates endpoint.ex to use this serializer.

socket "/socket", MyAppWeb.ChannelSocket,
    websocket: [
      connect_info: [:peer_data],
      serializer: [{ToonEx.Phoenix.Serializer, "~> 2.0.0"}]
    ],
    longpoll: false

Note: This is a workround for avoid add Phoenix library dependency.

Summary

Functions

decode!(raw_message, opts)

decode_text(raw_message)

encode!(reply)

fastlane!(msg)