Phoenix.Socket.Serializer behaviour
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.
Summary
Callbacks
- decode!(iodata, options)
Decodes iodata into
Phoenix.Socket.Message
struct.- encode!(arg1)
Encodes
Phoenix.Socket.Message
andPhoenix.Socket.Reply
structs to push format.- fastlane!(arg1)
Encodes a
Phoenix.Socket.Broadcast
struct to fastlane format.
Callbacks
decode!(iodata, options)
Specs
decode!(iodata(), options :: Keyword.t()) :: Phoenix.Socket.Message.t()
Decodes iodata into Phoenix.Socket.Message
struct.
encode!(arg1)
Specs
encode!(Phoenix.Socket.Message.t() | Phoenix.Socket.Reply.t()) :: {:socket_push, :text, iodata()} | {:socket_push, :binary, iodata()}
Encodes Phoenix.Socket.Message
and Phoenix.Socket.Reply
structs to push format.
fastlane!(arg1)
Specs
fastlane!(Phoenix.Socket.Broadcast.t()) :: {:socket_push, :text, iodata()} | {:socket_push, :binary, iodata()}
Encodes a Phoenix.Socket.Broadcast
struct to fastlane format.
© 2014 Chris McCord
Licensed under the MIT License.
https://hexdocs.pm/phoenix/Phoenix.Socket.Serializer.html