Module Contents¶
Classes¶
Base class for WAMP serializers. A WAMP serializer is the core glue between |
|
Base class for WAMP serializers. A WAMP serializer is the core glue between |
- class autobahn.wamp.serializer.Serializer(serializer)[source]¶
Bases:
object
Base class for WAMP serializers. A WAMP serializer is the core glue between parsed WAMP message objects and the bytes on wire (the transport).
- RATED_MESSAGE_SIZE = 512¶
Serialized WAMP message payload size per rated WAMP message.
- MESSAGE_TYPE_MAP¶
Mapping of WAMP message type codes to WAMP message classes.
- stats_reset()[source]¶
Get serializer statistics: timestamp when statistics were last reset.
- Returns
Last reset time of statistics (UTC, ns since Unix epoch)
- Return type
- stats_bytes()[source]¶
Get serializer statistics: bytes (serialized + unserialized).
- Returns
Number of bytes.
- Return type
- stats_messages()[source]¶
Get serializer statistics: messages (serialized + unserialized).
- Returns
Number of messages.
- Return type
- stats_rated_messages()[source]¶
Get serializer statistics: rated messages (serialized + unserialized).
- Returns
Number of rated messages.
- Return type
- set_stats_autoreset(rated_messages, duration, callback, reset_now=False)[source]¶
Configure a user callback invoked when accumulated stats hit specified threshold. When the specified number of rated messages have been processed or the specified duration has passed, statistics are automatically reset, and the last statistics is provided to the user callback.
- Parameters
rated_messages (int) – Number of rated messages that should trigger an auto-reset.
duration (int) – Duration in ns that when passed will trigger an auto-reset.
callback (callable) – User callback to be invoked when statistics are auto-reset. The function will be invoked with a single positional argument: the accumulated statistics before the reset.
- stats(reset=True, details=False)[source]¶
Get (and reset) serializer statistics.
- Parameters
- Returns
Serializer statistics, eg:
{ "timestamp": 1574156576688704693, "duration": 34000000000, "bytes": 0, "messages": 0, "rated_messages": 0 }
- Return type
- serialize(msg: autobahn.wamp.interfaces.IMessage) Tuple[bytes, bool] [source]¶
- unserialize(payload: bytes, isBinary: Optional[bool] = None) List[autobahn.wamp.interfaces.IMessage] [source]¶
Implements
autobahn.wamp.interfaces.ISerializer.unserialize()
- class autobahn.wamp.serializer.JsonObjectSerializer(batched=False, use_binary_hex_encoding=False, use_decimal_from_str=False, use_decimal_from_float=False)[source]¶
Bases:
object
- JSON_MODULE¶
The JSON module used (now only stdlib).
- NAME = json¶
- BINARY = False¶
- serialize(obj)[source]¶
Implements
autobahn.wamp.interfaces.IObjectSerializer.serialize()
- unserialize(payload)[source]¶
Implements
autobahn.wamp.interfaces.IObjectSerializer.unserialize()
- class autobahn.wamp.serializer.JsonSerializer(batched=False, use_binary_hex_encoding=False, use_decimal_from_str=False)[source]¶
Bases:
Serializer
Base class for WAMP serializers. A WAMP serializer is the core glue between parsed WAMP message objects and the bytes on wire (the transport).
- SERIALIZER_ID = json¶
ID used as part of the WebSocket subprotocol name to identify the serializer with WAMP-over-WebSocket.
- RAWSOCKET_SERIALIZER_ID = 1¶
ID used in lower four bits of second octet in RawSocket opening handshake identify the serializer with WAMP-over-RawSocket.
- MIME_TYPE = application/json¶
MIME type announced in HTTP request/response headers when running WAMP-over-Longpoll HTTP fallback.