Phoenix v1.4.0 Phoenix.Socket.Serializer behaviour View Source
A behaviour that serializes incoming and outgoing socket messages.
By default Phoenix provides Phoenix.Socket.V2.JSONSerializer
that
encodes to JSON and decodes JSON messages.
Custom serializers may be configured in the socket.
Link to this section Summary
Callbacks
Decodes iodata into Phoenix.Socket.Message
struct
Encodes Phoenix.Socket.Message
and Phoenix.Socket.Reply
structs to push format
Encodes a Phoenix.Socket.Broadcast
struct to fastlane format
Link to this section Callbacks
Link to this callback
decode!(iodata, options)
View Source
decode!(iodata(), options :: Keyword.t()) :: Phoenix.Socket.Message.t()
Decodes iodata into Phoenix.Socket.Message
struct.
Link to this callback
encode!(arg0)
View Source
encode!(Phoenix.Socket.Message.t() | Phoenix.Socket.Reply.t()) :: {:socket_push, :text, String.t()} | {:socket_push, :binary, binary()}
Encodes Phoenix.Socket.Message
and Phoenix.Socket.Reply
structs to push format.
Link to this callback
fastlane!(arg0)
View Source
fastlane!(Phoenix.Socket.Broadcast.t()) :: {:socket_push, :text, String.t()} | {:socket_push, :binary, binary()}
Encodes a Phoenix.Socket.Broadcast
struct to fastlane format.