Module Contents¶
Classes¶
WAMP message base class. |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP UNREGISTER message. |
|
A WAMP |
|
A WAMP |
|
A WAMP |
|
A WAMP |
Functions¶
|
For WAMP payload transparency mode, check if the provided |
|
For WAMP payload transparency mode, check if the provided |
|
Identify the real name category of the given value: |
|
Check a value for being a valid WAMP URI. |
|
Check a value for being a valid WAMP URI. |
|
Check a value for being a valid WAMP ID. |
|
Check a value for being a valid WAMP extra dictionary. |
Attributes¶
- autobahn.wamp.message.PAYLOAD_ENC_CRYPTO_BOX = cryptobox¶
- autobahn.wamp.message.PAYLOAD_ENC_MQTT = mqtt¶
- autobahn.wamp.message.PAYLOAD_ENC_STANDARD_IDENTIFIERS¶
- autobahn.wamp.message.is_valid_enc_algo(enc_algo)[source]¶
For WAMP payload transparency mode, check if the provided
enc_algo
identifier in the WAMP message is a valid one.Currently defined standard identifiers are:
"cryptobox"
"mqtt"
"xbr"
Users can select arbitrary identifiers too, but these MUST start with
"x_"
.
- autobahn.wamp.message.is_valid_enc_serializer(enc_serializer)[source]¶
For WAMP payload transparency mode, check if the provided
enc_serializer
identifier in the WAMP message is a valid one.Currently, the only standard defined identifier are
"json"
"msgpack"
"cbor"
"ubjson"
"flatbuffers"
Users can select arbitrary identifiers too, but these MUST start with
"x_"
.
- autobahn.wamp.message.identify_realm_name_category(value: Any) Optional[str] [source]¶
Identify the real name category of the given value:
"standalone"
: A normal, standalone WAMP realm name, e.g."realm1"
."eth"
: An Ethereum address, e.g."0xe59C7418403CF1D973485B36660728a5f4A8fF9c"
."ens"
: An Ethereum ENS name, e.g."wamp-proto.eth"
."reverse_ens"
: An Ethereum ENS name in reverse notation, e.g."eth.wamp-proto"
.None
: The value is not a WAMP realm name.
- Parameters
value – The value for which to identify realm name category.
- Returns
The category identified, one of
["standalone", "eth", "ens", "reverse-ens"]
orNone
.
- autobahn.wamp.message.check_or_raise_uri(value: Any, message: str = 'WAMP message invalid', strict: bool = False, allow_empty_components: bool = False, allow_last_empty: bool = False, allow_none: bool = False) str [source]¶
Check a value for being a valid WAMP URI.
If the value is not a valid WAMP URI is invalid, raises
autobahn.wamp.exception.InvalidUriError
, otherwise returns the value.- Parameters
value – The value to check.
message – Prefix for message in exception raised when value is invalid.
strict – If
True
, do a strict check on the URI (the WAMP spec SHOULD behavior).allow_empty_components – If
True
, allow empty URI components (for pattern based subscriptions and registrations).allow_last_empty – If
True
, allow the last URI component to be empty (for prefix based subscriptions and registrations).allow_none – If
True
, allowNone
for URIs.
- Returns
The URI value (if valid).
- Raises
instance of
autobahn.wamp.exception.InvalidUriError
- autobahn.wamp.message.check_or_raise_realm_name(value, message='WAMP message invalid', allow_eth=True)[source]¶
Check a value for being a valid WAMP URI.
If the value is not a valid WAMP URI is invalid, raises
autobahn.wamp.exception.InvalidUriError
, otherwise returns the value.- Parameters
value – The value to check, e.g.
"realm1"
or"com.example.myapp"
or"eth.example"
.message – Prefix for message in exception raised when value is invalid.
allow_eth – If
True
, allow Ethereum addresses as realm names, e.g."0xe59C7418403CF1D973485B36660728a5f4A8fF9c"
.
- Returns
The URI value (if valid).
- Raises
instance of
autobahn.wamp.exception.InvalidUriError
- autobahn.wamp.message.check_or_raise_id(value: Any, message: str = 'WAMP message invalid') int [source]¶
Check a value for being a valid WAMP ID.
If the value is not a valid WAMP ID, raises
autobahn.wamp.exception.ProtocolError
, otherwise return the value.- Parameters
value – The value to check.
message – Prefix for message in exception raised when value is invalid.
- Returns
The ID value (if valid).
- Raises
instance of
autobahn.wamp.exception.ProtocolError
- autobahn.wamp.message.check_or_raise_extra(value: Any, message: str = 'WAMP message invalid') Dict[str, Any] [source]¶
Check a value for being a valid WAMP extra dictionary.
If the value is not a valid WAMP extra dictionary, raises
autobahn.wamp.exception.ProtocolError
, otherwise return the value.- Parameters
value – The value to check.
message – Prefix for message in exception raised when value is invalid.
- Returns
The extra dictionary (if valid).
- Raises
instance of
autobahn.wamp.exception.ProtocolError
- class autobahn.wamp.message.Message(from_fbs=None)[source]¶
Bases:
object
WAMP message base class.
Note
This is not supposed to be instantiated, but subclassed only.
- property correlation_id¶
- property correlation_uri¶
- property correlation_is_anchor¶
- property correlation_is_last¶
- MESSAGE_TYPE¶
WAMP message type code.
- __slots__ = ['_from_fbs', '_serialized', '_correlation_id', '_correlation_uri', '_correlation_is_anchor',...¶
- __eq__(other)[source]¶
Compare this message to another message for equality.
- Parameters
other (obj) – The other message to compare with.
- Returns
True
iff the messages are equal.- Return type
- __ne__(other)[source]¶
Compare this message to another message for inequality.
- Parameters
other (obj) – The other message to compare with.
- Returns
True
iff the messages are not equal.- Return type
- abstract static parse(wmsg)[source]¶
Factory method that parses a unserialized raw message (as returned byte
autobahn.interfaces.ISerializer.unserialize()
) into an instance of this class.- Returns
An instance of this class.
- Return type
obj
- serialize(serializer)[source]¶
Serialize this object into a wire level bytes representation and cache the resulting bytes. If the cache already contains an entry for the given serializer, return the cached representation directly.
- Parameters
serializer (An instance that implements
autobahn.interfaces.ISerializer
) – The wire level serializer to use.- Returns
The serialized bytes.
- Return type
- class autobahn.wamp.message.Hello(realm, roles, authmethods=None, authid=None, authrole=None, authextra=None, resumable=None, resume_session=None, resume_token=None)[source]¶
Bases:
Message
A WAMP
HELLO
message.Format:
[HELLO, Realm|uri, Details|dict]
- MESSAGE_TYPE = 1¶
The WAMP message code for this type of message.
- __slots__ = ['realm', 'roles', 'authmethods', 'authid', 'authrole', 'authextra', 'resumable',...¶
- class autobahn.wamp.message.Welcome(session, roles, realm=None, authid=None, authrole=None, authmethod=None, authprovider=None, authextra=None, resumed=None, resumable=None, resume_token=None, custom=None)[source]¶
Bases:
Message
A WAMP
WELCOME
message.Format:
[WELCOME, Session|id, Details|dict]
- MESSAGE_TYPE = 2¶
The WAMP message code for this type of message.
- __slots__ = ['session', 'roles', 'realm', 'authid', 'authrole', 'authmethod', 'authprovider', 'authextra',...¶
- class autobahn.wamp.message.Abort(reason, message=None)[source]¶
Bases:
Message
A WAMP
ABORT
message.Format:
[ABORT, Details|dict, Reason|uri]
- MESSAGE_TYPE = 3¶
The WAMP message code for this type of message.
- __slots__ = ['reason', 'message']¶
- class autobahn.wamp.message.Challenge(method, extra=None)[source]¶
Bases:
Message
A WAMP
CHALLENGE
message.Format:
[CHALLENGE, Method|string, Extra|dict]
- MESSAGE_TYPE = 4¶
The WAMP message code for this type of message.
- __slots__ = ['method', 'extra']¶
- class autobahn.wamp.message.Authenticate(signature, extra=None)[source]¶
Bases:
Message
A WAMP
AUTHENTICATE
message.Format:
[AUTHENTICATE, Signature|string, Extra|dict]
- MESSAGE_TYPE = 5¶
The WAMP message code for this type of message.
- __slots__ = ['signature', 'extra']¶
- class autobahn.wamp.message.Goodbye(reason=DEFAULT_REASON, message=None, resumable=None)[source]¶
Bases:
Message
A WAMP
GOODBYE
message.Format:
[GOODBYE, Details|dict, Reason|uri]
- MESSAGE_TYPE = 6¶
The WAMP message code for this type of message.
- DEFAULT_REASON = wamp.close.normal¶
Default WAMP closing reason.
- __slots__ = ['reason', 'message', 'resumable']¶
- class autobahn.wamp.message.Error(request_type, request, error, args=None, kwargs=None, payload=None, enc_algo=None, enc_key=None, enc_serializer=None, callee=None, callee_authid=None, callee_authrole=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
ERROR
message.Formats:
[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri]
[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri, Arguments|list]
[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri, Arguments|list, ArgumentsKw|dict]
[ERROR, REQUEST.Type|int, REQUEST.Request|id, Details|dict, Error|uri, Payload|binary]
- MESSAGE_TYPE = 8¶
The WAMP message code for this type of message.
- __slots__ = ['request_type', 'request', 'error', 'args', 'kwargs', 'payload', 'enc_algo', 'enc_key',...¶
- class autobahn.wamp.message.Publish(request=None, topic=None, args=None, kwargs=None, payload=None, acknowledge=None, exclude_me=None, exclude=None, exclude_authid=None, exclude_authrole=None, eligible=None, eligible_authid=None, eligible_authrole=None, retain=None, transaction_hash=None, enc_algo=None, enc_key=None, enc_serializer=None, forward_for=None, from_fbs=None)[source]¶
Bases:
Message
A WAMP
PUBLISH
message.Formats:
[PUBLISH, Request|id, Options|dict, Topic|uri]
[PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list]
[PUBLISH, Request|id, Options|dict, Topic|uri, Arguments|list, ArgumentsKw|dict]
[PUBLISH, Request|id, Options|dict, Topic|uri, Payload|binary]
- property request¶
- property topic¶
- property args¶
- property kwargs¶
- property payload¶
- property acknowledge¶
- property exclude_me¶
- property exclude¶
- property exclude_authid¶
- property exclude_authrole¶
- property eligible¶
- property eligible_authid¶
- property eligible_authrole¶
- property retain¶
- property transaction_hash¶
- property enc_algo¶
- property enc_key¶
- property enc_serializer¶
- property forward_for¶
- MESSAGE_TYPE = 16¶
The WAMP message code for this type of message.
- __slots__ = ['_request', '_topic', '_args', '_kwargs', '_payload', '_enc_algo', '_enc_serializer',...¶
- __eq__(other)[source]¶
Compare this message to another message for equality.
- Parameters
other (obj) – The other message to compare with.
- Returns
True
iff the messages are equal.- Return type
- __ne__(other)[source]¶
Compare this message to another message for inequality.
- Parameters
other (obj) – The other message to compare with.
- Returns
True
iff the messages are not equal.- Return type
- class autobahn.wamp.message.Published(request, publication)[source]¶
Bases:
Message
A WAMP
PUBLISHED
message.Format:
[PUBLISHED, PUBLISH.Request|id, Publication|id]
- MESSAGE_TYPE = 17¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'publication']¶
- class autobahn.wamp.message.Subscribe(request, topic, match=None, get_retained=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
SUBSCRIBE
message.Format:
[SUBSCRIBE, Request|id, Options|dict, Topic|uri]
- MESSAGE_TYPE = 32¶
The WAMP message code for this type of message.
- MATCH_EXACT = exact¶
- MATCH_PREFIX = prefix¶
- MATCH_WILDCARD = wildcard¶
- __slots__ = ['request', 'topic', 'match', 'get_retained', 'forward_for']¶
- class autobahn.wamp.message.Subscribed(request, subscription)[source]¶
Bases:
Message
A WAMP
SUBSCRIBED
message.Format:
[SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]
- MESSAGE_TYPE = 33¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'subscription']¶
- class autobahn.wamp.message.Unsubscribe(request, subscription, forward_for=None)[source]¶
Bases:
Message
A WAMP
UNSUBSCRIBE
message.Formats:
[UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]
[UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id, Options|dict]
- MESSAGE_TYPE = 34¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'subscription', 'forward_for']¶
- class autobahn.wamp.message.Unsubscribed(request, subscription=None, reason=None)[source]¶
Bases:
Message
A WAMP
UNSUBSCRIBED
message.Formats:
[UNSUBSCRIBED, UNSUBSCRIBE.Request|id]
[UNSUBSCRIBED, UNSUBSCRIBE.Request|id, Details|dict]
- MESSAGE_TYPE = 35¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'subscription', 'reason']¶
- class autobahn.wamp.message.Event(subscription=None, publication=None, args=None, kwargs=None, payload=None, publisher=None, publisher_authid=None, publisher_authrole=None, topic=None, retained=None, transaction_hash=None, x_acknowledged_delivery=None, enc_algo=None, enc_key=None, enc_serializer=None, forward_for=None, from_fbs=None)[source]¶
Bases:
Message
A WAMP
EVENT
message.Formats:
[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict]
[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Arguments|list]
[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Arguments|list, PUBLISH.ArgumentsKw|dict]
[EVENT, SUBSCRIBED.Subscription|id, PUBLISHED.Publication|id, Details|dict, PUBLISH.Payload|binary]
- property subscription¶
- property publication¶
- property args¶
- property kwargs¶
- property payload¶
- property publisher¶
- property publisher_authid¶
- property publisher_authrole¶
- property topic¶
- property retained¶
- property transaction_hash¶
- property x_acknowledged_delivery¶
- property enc_algo¶
- property enc_key¶
- property enc_serializer¶
- property forward_for¶
- MESSAGE_TYPE = 36¶
The WAMP message code for this type of message.
- __slots__ = ['_subscription', '_publication', '_args', '_kwargs', '_payload', '_enc_algo',...¶
- __eq__(other)[source]¶
Compare this message to another message for equality.
- Parameters
other (obj) – The other message to compare with.
- Returns
True
iff the messages are equal.- Return type
- __ne__(other)[source]¶
Compare this message to another message for inequality.
- Parameters
other (obj) – The other message to compare with.
- Returns
True
iff the messages are not equal.- Return type
- class autobahn.wamp.message.Call(request, procedure, args=None, kwargs=None, payload=None, timeout=None, receive_progress=None, transaction_hash=None, enc_algo=None, enc_key=None, enc_serializer=None, caller=None, caller_authid=None, caller_authrole=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
CALL
message.Formats:
[CALL, Request|id, Options|dict, Procedure|uri]
[CALL, Request|id, Options|dict, Procedure|uri, Arguments|list]
[CALL, Request|id, Options|dict, Procedure|uri, Arguments|list, ArgumentsKw|dict]
[CALL, Request|id, Options|dict, Procedure|uri, Payload|binary]
- MESSAGE_TYPE = 48¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'procedure', 'args', 'kwargs', 'payload', 'timeout', 'receive_progress',...¶
- class autobahn.wamp.message.Cancel(request, mode=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
CANCEL
message.Format:
[CANCEL, CALL.Request|id, Options|dict]
See: https://wamp-proto.org/static/rfc/draft-oberstet-hybi-crossbar-wamp.html#rfc.section.14.3.4
- MESSAGE_TYPE = 49¶
The WAMP message code for this type of message.
- SKIP = skip¶
- KILL = kill¶
- KILLNOWAIT = killnowait¶
- __slots__ = ['request', 'mode', 'forward_for']¶
- class autobahn.wamp.message.Result(request, args=None, kwargs=None, payload=None, progress=None, enc_algo=None, enc_key=None, enc_serializer=None, callee=None, callee_authid=None, callee_authrole=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
RESULT
message.Formats:
[RESULT, CALL.Request|id, Details|dict]
[RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list]
[RESULT, CALL.Request|id, Details|dict, YIELD.Arguments|list, YIELD.ArgumentsKw|dict]
[RESULT, CALL.Request|id, Details|dict, Payload|binary]
- MESSAGE_TYPE = 50¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'args', 'kwargs', 'payload', 'progress', 'enc_algo', 'enc_key', 'enc_serializer',...¶
- class autobahn.wamp.message.Register(request, procedure, match=None, invoke=None, concurrency=None, force_reregister=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
REGISTER
message.Format:
[REGISTER, Request|id, Options|dict, Procedure|uri]
- MESSAGE_TYPE = 64¶
The WAMP message code for this type of message.
- MATCH_EXACT = exact¶
- MATCH_PREFIX = prefix¶
- MATCH_WILDCARD = wildcard¶
- INVOKE_SINGLE = single¶
- INVOKE_FIRST = first¶
- INVOKE_LAST = last¶
- INVOKE_ROUNDROBIN = roundrobin¶
- INVOKE_RANDOM = random¶
- INVOKE_ALL = all¶
- __slots__ = ['request', 'procedure', 'match', 'invoke', 'concurrency', 'force_reregister', 'forward_for']¶
- class autobahn.wamp.message.Registered(request, registration)[source]¶
Bases:
Message
A WAMP
REGISTERED
message.Format:
[REGISTERED, REGISTER.Request|id, Registration|id]
- MESSAGE_TYPE = 65¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'registration']¶
- class autobahn.wamp.message.Unregister(request, registration, forward_for=None)[source]¶
Bases:
Message
A WAMP UNREGISTER message.
Formats:
[UNREGISTER, Request|id, REGISTERED.Registration|id]
[UNREGISTER, Request|id, REGISTERED.Registration|id, Options|dict]
- MESSAGE_TYPE = 66¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'registration', 'forward_for']¶
- class autobahn.wamp.message.Unregistered(request, registration=None, reason=None)[source]¶
Bases:
Message
A WAMP
UNREGISTERED
message.Formats:
[UNREGISTERED, UNREGISTER.Request|id]
[UNREGISTERED, UNREGISTER.Request|id, Details|dict]
- MESSAGE_TYPE = 67¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'registration', 'reason']¶
- class autobahn.wamp.message.Invocation(request, registration, args=None, kwargs=None, payload=None, timeout=None, receive_progress=None, caller=None, caller_authid=None, caller_authrole=None, procedure=None, transaction_hash=None, enc_algo=None, enc_key=None, enc_serializer=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
INVOCATION
message.Formats:
[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict]
[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, CALL.Arguments|list]
[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, CALL.Arguments|list, CALL.ArgumentsKw|dict]
[INVOCATION, Request|id, REGISTERED.Registration|id, Details|dict, Payload|binary]
- MESSAGE_TYPE = 68¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'registration', 'args', 'kwargs', 'payload', 'timeout', 'receive_progress',...¶
- class autobahn.wamp.message.Interrupt(request, mode=None, reason=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
INTERRUPT
message.Format:
[INTERRUPT, INVOCATION.Request|id, Options|dict]
See: https://wamp-proto.org/static/rfc/draft-oberstet-hybi-crossbar-wamp.html#rfc.section.14.3.4
- MESSAGE_TYPE = 69¶
The WAMP message code for this type of message.
- KILL = kill¶
- KILLNOWAIT = killnowait¶
- __slots__ = ['request', 'mode', 'reason', 'forward_for']¶
- class autobahn.wamp.message.Yield(request, args=None, kwargs=None, payload=None, progress=None, enc_algo=None, enc_key=None, enc_serializer=None, callee=None, callee_authid=None, callee_authrole=None, forward_for=None)[source]¶
Bases:
Message
A WAMP
YIELD
message.Formats:
[YIELD, INVOCATION.Request|id, Options|dict]
[YIELD, INVOCATION.Request|id, Options|dict, Arguments|list]
[YIELD, INVOCATION.Request|id, Options|dict, Arguments|list, ArgumentsKw|dict]
[YIELD, INVOCATION.Request|id, Options|dict, Payload|binary]
- MESSAGE_TYPE = 70¶
The WAMP message code for this type of message.
- __slots__ = ['request', 'args', 'kwargs', 'payload', 'progress', 'enc_algo', 'enc_key', 'enc_serializer',...¶