aiomas.codecs
¶
This package imports the codecs that can be used for de- and encoding incoming and outgoing messages:
All codecs should implement the base class Codec
.
-
class
aiomas.codecs.
Codec
[source]¶ Base class for all Codecs.
Subclasses must implement
encode()
anddecode()
.-
add_serializer
(type, serialize, deserialize)[source]¶ Add methods to serialize and deserialize objects typed type.
This can be used to de-/encode objects that the codec otherwise couldn’t encode.
serialize will receive the unencoded object and needs to return an encodable serialization of it.
deserialize will receive an objects representation and should return an instance of the original object.
-