aiowamp.JSONSerializer¶
-
class
aiowamp.JSONSerializer(*, decoder=None, encoder=None)[source]¶ Serializer for the JSON format.
Provides a custom
json.JSONDecoderandjson.JSONEncoderwhich handle the special WAMP string format for binary data.Parameters: Methods
__init__(*[, decoder, encoder])type decoder: Optional[JSONDecoder]deserialize(data)Deserialise the bytesrepresentation of a message.serialize(msg)Serialise a message. Attributes
decoderJSON decoder used to decode incoming messages. encoderJSON encoder used to encode outgoing messages. -
__init__(*, decoder=None, encoder=None)[source] Parameters: Return type: None
-
decoder¶ JSON decoder used to decode incoming messages.
-
encoder¶ JSON encoder used to encode outgoing messages.
-
serialize(msg)[source]¶ Serialise a message.
Parameters: msg ( MessageABC) – Message to serialise.Return type: bytesReturns: bytesrepresentation of the message.Raises: Exception– If the message couldn’t be serialised.
-
deserialize(data)[source]¶ Deserialise the
bytesrepresentation of a message.Parameters: Return type: MessageABCReturns: Deserialised message.
Raises: aiowamp.InvalidMessage– If the deserialised data isn’t a message.Exception– If the message couldn’t be deserialised.
-