Combo.Socket.Serializer behaviour (combo v0.8.0)
View SourceA behaviour that serializes incoming and outgoing socket messages.
By default, Combo provides a serializer that encodes to JSON and decodes JSON messages.
Custom serializers may be configured in the socket.
Summary
Callbacks
Decodes iodata into Combo.Socket.Message struct.
Encodes Combo.Socket.Message and Combo.Socket.Reply structs to push format.
Encodes a Combo.Socket.Broadcast struct to fastlane format.
Callbacks
@callback decode!(iodata(), options :: keyword()) :: Combo.Socket.Message.t()
Decodes iodata into Combo.Socket.Message struct.
@callback encode!(Combo.Socket.Message.t() | Combo.Socket.Reply.t()) :: {:socket_push, :text, iodata()} | {:socket_push, :binary, iodata()}
Encodes Combo.Socket.Message and Combo.Socket.Reply structs to push format.
@callback fastlane!(Combo.Socket.Broadcast.t()) :: {:socket_push, :text, iodata()} | {:socket_push, :binary, iodata()}
Encodes a Combo.Socket.Broadcast struct to fastlane format.