autobahn.wamp.auth.
generate_totp_secret
(length=10)[source]¶Generates a new Base32 encoded, random secret.
See also
Parameters: | length (int) – The length of the entropy used to generate the secret. |
---|---|
Returns: | The generated secret in Base32 (letters A-Z and digits 2-7 ).
The length of the generated secret is length * 8 / 5 octets. |
Return type: | bytes |
autobahn.wamp.auth.
compute_totp
(secret, offset=0)[source]¶Computes the current TOTP code.
Parameters: | |
---|---|
Returns: | TOTP for current time (+/- offset). |
Return type: |
autobahn.wamp.auth.
pbkdf2
(data, salt, iterations=1000, keylen=32, hashfunc=None)[source]¶Returns a binary digest for the PBKDF2 hash algorithm of data
with the given salt
. It iterates iterations
time and produces a
key of keylen
bytes. By default SHA-256 is used as hash function,
a different hashlib hashfunc
can be provided.
Parameters: |
|
---|---|
Returns: | The derived cryptographic key. |
Return type: |
autobahn.wamp.auth.
derive_key
(secret, salt, iterations=1000, keylen=32)[source]¶Computes a derived cryptographic key from a password according to PBKDF2.
See also
Parameters: | |
---|---|
Returns: | The derived key in Base64 encoding. |
Return type: |
autobahn.wamp.auth.
generate_wcs
(length=14)[source]¶Generates a new random secret for use with WAMP-CRA.
The secret generated is a random character sequence drawn from
Parameters: | length (int) – The length of the secret to generate. |
---|---|
Returns: | The generated secret. The length of the generated is length octets. |
Return type: | bytes |
autobahn.wamp.exception.
Error
(reason)[source]¶Bases: exceptions.RuntimeError
Base class for all exceptions related to WAMP.
Parameters: | reason (unicode) – Description of WAMP error that occurred (for logging purposes). |
---|
autobahn.wamp.exception.
SessionNotReady
(reason)[source]¶Bases: autobahn.wamp.exception.Error
The application tried to perform a WAMP interaction, but the session is not yet fully established.
Parameters: | reason (unicode) – Description of WAMP error that occurred (for logging purposes). |
---|
autobahn.wamp.exception.
SerializationError
(reason)[source]¶Bases: autobahn.wamp.exception.Error
Exception raised when the WAMP serializer could not serialize the
application payload (args
or kwargs
for CALL
, PUBLISH
, etc).
Parameters: | reason (unicode) – Description of WAMP error that occurred (for logging purposes). |
---|
autobahn.wamp.exception.
ProtocolError
(reason)[source]¶Bases: autobahn.wamp.exception.Error
Exception raised when WAMP protocol was violated. Protocol errors are fatal and are handled by the WAMP implementation. They are not supposed to be handled at the application level.
Parameters: | reason (unicode) – Description of WAMP error that occurred (for logging purposes). |
---|
autobahn.wamp.exception.
TransportLost
[source]¶Bases: autobahn.wamp.exception.Error
Exception raised when the transport underlying the WAMP session was lost or is not connected.
autobahn.wamp.exception.
ApplicationError
(error, *args, **kwargs)[source]¶Bases: autobahn.wamp.exception.Error
Base class for all exceptions that can/may be handled at the application level.
Parameters: | error (unicode) – The URI of the error that occurred, e.g. wamp.error.not_authorized . |
---|
INVALID_URI
= u'wamp.error.invalid_uri'¶Peer provided an incorrect URI for a URI-based attribute of a WAMP message such as a realm, topic or procedure.
NO_SUCH_PROCEDURE
= u'wamp.error.no_such_procedure'¶A Dealer could not perform a call, since not procedure is currently registered under the given URI.
PROCEDURE_ALREADY_EXISTS
= u'wamp.error.procedure_already_exists'¶A procedure could not be registered, since a procedure with the given URI is already registered.
NO_SUCH_REGISTRATION
= u'wamp.error.no_such_registration'¶A Dealer could not perform a unregister, since the given registration is not active.
NO_SUCH_SUBSCRIPTION
= u'wamp.error.no_such_subscription'¶A Broker could not perform a unsubscribe, since the given subscription is not active.
INVALID_ARGUMENT
= u'wamp.error.invalid_argument'¶A call failed, since the given argument types or values are not acceptable to the
called procedure - in which case the Callee may throw this error. Or a Router
performing payload validation checked the payload (args
/ kwargs
) of a call,
call result, call error or publish, and the payload did not conform.
SYSTEM_SHUTDOWN
= u'wamp.error.system_shutdown'¶The Peer is shutting down completely - used as a GOODBYE
(or ABORT
) reason.
CLOSE_REALM
= u'wamp.error.close_realm'¶The Peer want to leave the realm - used as a GOODBYE
reason.
GOODBYE_AND_OUT
= u'wamp.error.goodbye_and_out'¶A Peer acknowledges ending of a session - used as a GOOBYE
reply reason.
NOT_AUTHORIZED
= u'wamp.error.not_authorized'¶A call, register, publish or subscribe failed, since the session is not authorized to perform the operation.
AUTHORIZATION_FAILED
= u'wamp.error.authorization_failed'¶A Dealer or Broker could not determine if the Peer is authorized to perform a join, call, register, publish or subscribe, since the authorization operation itself failed. E.g. a custom authorizer did run into an error.
NO_SUCH_REALM
= u'wamp.error.no_such_realm'¶Peer wanted to join a non-existing realm (and the Router did not allow to auto-create the realm).
NO_SUCH_ROLE
= u'wamp.error.no_such_role'¶A Peer was to be authenticated under a Role that does not (or no longer) exists on the Router. For example, the Peer was successfully authenticated, but the Role configured does not exists - hence there is some misconfiguration in the Router.
CANCELED
= u'wamp.error.canceled'¶A Dealer or Callee canceled a call previously issued (WAMP AP).
OPTION_DISALLOWED_DISCLOSE_ME
= u'wamp.error.option_disallowed.disclose_me'¶A Router rejected client request to disclose its identity (WAMP AP).
NO_ELIGIBLE_CALLEE
= u'wamp.error.no_eligible_callee'¶A Dealer could not perform a call, since a procedure with the given URI is registered, but Callee Black- and Whitelisting and/or Caller Exclusion lead to the exclusion of (any) Callee providing the procedure (WAMP AP).
autobahn.wamp.interfaces.
IObjectSerializer
[source]¶Bases: object
Raw Python object serialization and deserialization. Object serializers are
used by classes implementing WAMP serializers, that is instances of
autobahn.wamp.interfaces.ISerializer
.
BINARY
¶Flag (read-only) to indicate if serializer requires a binary clean transport or if UTF8 transparency is sufficient.
autobahn.wamp.interfaces.
IMessage
[source]¶Bases: object
A WAMP message.
MESSAGE_TYPE
¶WAMP message type code.
marshal
()[source]¶Marshal this object into a raw message for subsequent serialization to bytes.
Returns: | list – The serialized raw message. |
---|
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: | obj – An instance of this class. |
---|
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: | bytes – The serialized bytes. |
autobahn.wamp.interfaces.
ISerializer
[source]¶Bases: object
WAMP message serialization and deserialization.
MESSAGE_TYPE_MAP
¶Mapping of WAMP message type codes to WAMP message classes.
SERIALIZER_ID
¶The WAMP serialization format ID.
serialize
(message)[source]¶Serializes a WAMP message to bytes to be sent to a transport.
Parameters: | message (obj) – An instance that implements autobahn.wamp.interfaces.IMessage |
---|---|
Returns: | tuple – A pair (bytes, isBinary) . |
unserialize
(payload, isBinary)[source]¶Deserialize bytes from a transport and parse into WAMP messages.
Parameters: | payload (bytes) – Byte string from wire. |
---|---|
Returns: | list – List of objects that implement autobahn.wamp.interfaces.IMessage . |
autobahn.wamp.interfaces.
ITransport
[source]¶Bases: object
A WAMP transport is a bidirectional, full-duplex, reliable, ordered, message-based channel.
send
(message)[source]¶Send a WAMP message over the transport to the peer. If the transport is
not open, this raises autobahn.wamp.exception.TransportLost
.
Parameters: | message (obj) – An instance that implements autobahn.wamp.interfaces.IMessage |
---|
isOpen
()[source]¶Check if the transport is open for messaging.
Returns: | bool – True , if the transport is open. |
---|
autobahn.wamp.interfaces.
ITransportHandler
[source]¶Bases: object
onOpen
(transport)¶Callback fired when transport is open.
Parameters: | transport (obj) – An instance that implements autobahn.wamp.interfaces.ITransport |
---|
onMessage
(message)¶Callback fired when a WAMP message was received.
Parameters: | message (obj) – An instance that implements autobahn.wamp.interfaces.IMessage |
---|
autobahn.wamp.interfaces.
ISession
[source]¶Bases: object
Base interface for WAMP sessions.
onConnect
()[source]¶Callback fired when the transport this session will run over has been established.
join
(realm)[source]¶Attach the session to the given realm. A session is open as soon as it is attached to a realm.
onChallenge
(challenge)[source]¶Callback fired when the peer demands authentication.
Parameters: | challenge (Instance of autobahn.wamp.types.Challenge .) – The authentication challenge. |
---|
onJoin
(details)[source]¶Callback fired when WAMP session has been established.
Parameters: | details (Instance of autobahn.wamp.types.SessionDetails .) – Session information. |
---|
onLeave
(details)[source]¶Callback fired when WAMP session has is closed
Parameters: | details (Instance of autobahn.wamp.types.CloseDetails .) – Close information. |
---|
define
(exception, error=None)[source]¶Defines an exception for a WAMP error in the context of this WAMP session.
Parameters: |
|
---|
autobahn.wamp.interfaces.
ICaller
[source]¶Bases: autobahn.wamp.interfaces.ISession
Interface for WAMP peers implementing role Caller.
call
(procedure, *args, **kwargs)[source]¶Call a remote procedure.
This will return a Deferred/Future, that when resolved, provides the actual result returned by the called remote procedure.
autobahn.wamp.types.CallResult
.autobahn.wamp.exception.ApplicationError
.If kwargs
contains an options
keyword argument that is an instance of
autobahn.wamp.types.CallOptions
, this will provide specific options for
the call to perform.
When the Caller and Dealer implementations support canceling of calls, the call may be canceled by canceling the returned Deferred/Future.
Parameters: | |
---|---|
Returns: | A Deferred/Future for the call result - |
Return type: | instance of twisted.internet.defer.Deferred / |
autobahn.wamp.interfaces.
IRegistration
[source]¶Bases: object
Represents a registration of an endpoint.
id
¶Flag indicating if registration is active.
unregister
()[source]¶Unregister this registration that was previously created from
autobahn.wamp.interfaces.ICallee.register()
.
After a registration has been unregistered successfully, no calls will be routed to the endpoint anymore.
Returns an instance of twisted.internet.defer.Deferred (when
running on Twisted) or an instance of asyncio.Future
(when running on asyncio).
autobahn.wamp.exception.ApplicationError
.Returns: | A Deferred/Future for the unregistration |
---|---|
Return type: | instance(s) of twisted.internet.defer.Deferred / asyncio.Future |
autobahn.wamp.interfaces.
ICallee
[source]¶Bases: autobahn.wamp.interfaces.ISession
Interface for WAMP peers implementing role Callee.
register
(endpoint, procedure=None, options=None)[source]¶Register a procedure for remote calling.
When endpoint
is a callable (function, method or object that implements __call__
),
then procedure
must be provided and an instance of
twisted.internet.defer.Deferred (when running on Twisted) or an instance
of asyncio.Future
(when running on asyncio) is returned.
autobahn.wamp.interfaces.IRegistration
.autobahn.wamp.exception.ApplicationError
.When endpoint
is an object, then each of the object’s methods that is decorated
with autobahn.wamp.register()
is automatically registered and a list of
Deferreds/Futures is returned that each resolves or rejects as above.
Parameters: |
|
---|---|
Returns: | A registration or a list of registrations (or errors) |
Return type: | instance(s) of twisted.internet.defer.Deferred / |
autobahn.wamp.interfaces.
IPublication
[source]¶Bases: object
Represents a publication of an event. This is used with acknowledged publications.
id
¶The WAMP publication ID for this publication.
autobahn.wamp.interfaces.
IPublisher
[source]¶Bases: autobahn.wamp.interfaces.ISession
Interface for WAMP peers implementing role Publisher.
publish
(topic, *args, **kwargs)[source]¶Publish an event to a topic.
If kwargs
contains an options
keyword argument that is an instance of
autobahn.wamp.types.PublishOptions
, this will provide
specific options for the publish to perform.
Note
By default, publications are non-acknowledged and the publication can fail silently, e.g. because the session is not authorized to publish to the topic.
When publication acknowledgement is requested via options.acknowledge == True
,
this function returns a Deferred/Future:
autobahn.wamp.interfaces.IPublication
.autobahn.wamp.exception.ApplicationError
.Parameters: | |
---|---|
Returns: | Acknowledgement for acknowledge publications - otherwise nothing. |
Return type: |
|
autobahn.wamp.interfaces.
ISubscription
[source]¶Bases: object
Represents a subscription to a topic.
id
¶The WAMP subscription ID for this subscription.
active
¶Flag indicating if subscription is active.
unsubscribe
()[source]¶Unsubscribe this subscription that was previously created from
autobahn.wamp.interfaces.ISubscriber.subscribe()
.
After a subscription has been unsubscribed successfully, no events will be routed to the event handler anymore.
Returns an instance of twisted.internet.defer.Deferred (when
running on Twisted) or an instance of asyncio.Future
(when running on asyncio).
autobahn.wamp.exception.ApplicationError
.Returns: | A Deferred/Future for the unsubscription |
---|---|
Return type: | instance(s) of twisted.internet.defer.Deferred / asyncio.Future |
autobahn.wamp.interfaces.
ISubscriber
[source]¶Bases: autobahn.wamp.interfaces.ISession
Interface for WAMP peers implementing role Subscriber.
subscribe
(handler, topic=None, options=None)[source]¶Subscribe to a topic for receiving events.
When handler
is a callable (function, method or object that implements __call__
),
then topic must be provided and an instance of
twisted.internet.defer.Deferred (when running on Twisted) or an instance
of asyncio.Future
(when running on asyncio) is returned.
autobahn.wamp.interfaces.ISubscription
.autobahn.wamp.exception.ApplicationError
.When handler
is an object, then each of the object’s methods that is decorated
with autobahn.wamp.subscribe()
is automatically subscribed as event handlers,
and a list of Deferreds/Futures is returned that each resolves or rejects as above.
Parameters: |
|
---|---|
Returns: | A single Deferred/Future or a list of such objects |
Return type: | instance(s) of twisted.internet.defer.Deferred / |
autobahn.wamp.message.
check_or_raise_uri
(value, message=u'WAMP message invalid', strict=False, allowEmptyComponents=False)[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.ProtocolError
.
Otherwise return the value.
Parameters: |
|
---|---|
Returns: | The URI value (if valid). |
Return type: | unicode |
Raises: | instance of |
autobahn.wamp.message.
check_or_raise_id
(value, message=u'WAMP message invalid')[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: |
|
---|---|
Returns: | The ID value (if valid). |
Return type: | |
Raises: | instance of |
autobahn.wamp.message.
Message
[source]¶Bases: autobahn.util.EqualityMixin
WAMP message base class. Implements autobahn.wamp.interfaces.IMessage
.
Note
This is not supposed to be instantiated.
uncache
()[source]¶Implements autobahn.wamp.interfaces.IMessage.uncache()
autobahn.wamp.message.
Hello
(realm, roles, authmethods=None, authid=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP HELLO
message.
Format: [HELLO, Realm|uri, Details|dict]
Parameters: |
|
---|
MESSAGE_TYPE
= 1¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Welcome
(session, roles, authid=None, authrole=None, authmethod=None, authprovider=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP WELCOME
message.
Format: [WELCOME, Session|id, Details|dict]
Parameters: |
|
---|
MESSAGE_TYPE
= 2¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Abort
(reason, message=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP ABORT
message.
Format: [ABORT, Details|dict, Reason|uri]
Parameters: |
|
---|
MESSAGE_TYPE
= 3¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Challenge
(method, extra=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP CHALLENGE
message.
Format: [CHALLENGE, Method|string, Extra|dict]
Parameters: |
|
---|
MESSAGE_TYPE
= 4¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Authenticate
(signature, extra=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP AUTHENTICATE
message.
Format: [AUTHENTICATE, Signature|string, Extra|dict]
Parameters: |
|
---|
MESSAGE_TYPE
= 5¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Goodbye
(reason=u'wamp.goodbye.normal', message=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP GOODBYE
message.
Format: [GOODBYE, Details|dict, Reason|uri]
Parameters: |
|
---|
MESSAGE_TYPE
= 6¶The WAMP message code for this type of message.
DEFAULT_REASON
= u'wamp.goodbye.normal'¶Default WAMP closing reason.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Heartbeat
(incoming, outgoing, discard=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP HEARTBEAT
message.
Formats:
[HEARTBEAT, Incoming|integer, Outgoing|integer]
[HEARTBEAT, Incoming|integer, Outgoing|integer, Discard|string]
Parameters: |
---|
MESSAGE_TYPE
= 7¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Error
(request_type, request, error, args=None, kwargs=None)[source]¶Bases: autobahn.wamp.message.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]
Parameters: |
|
---|
MESSAGE_TYPE
= 8¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Publish
(request, topic, args=None, kwargs=None, acknowledge=None, excludeMe=None, exclude=None, eligible=None, discloseMe=None)[source]¶Bases: autobahn.wamp.message.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]
Parameters: |
|
---|
MESSAGE_TYPE
= 16¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Published
(request, publication)[source]¶Bases: autobahn.wamp.message.Message
A WAMP PUBLISHED
message.
Format: [PUBLISHED, PUBLISH.Request|id, Publication|id]
Parameters: |
---|
MESSAGE_TYPE
= 17¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Subscribe
(request, topic, match=u'exact')[source]¶Bases: autobahn.wamp.message.Message
A WAMP SUBSCRIBE
message.
Format: [SUBSCRIBE, Request|id, Options|dict, Topic|uri]
Parameters: |
|
---|
MESSAGE_TYPE
= 32¶The WAMP message code for this type of message.
MATCH_EXACT
= u'exact'¶MATCH_PREFIX
= u'prefix'¶MATCH_WILDCARD
= u'wildcard'¶parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Subscribed
(request, subscription)[source]¶Bases: autobahn.wamp.message.Message
A WAMP SUBSCRIBED
message.
Format: [SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]
Parameters: |
---|
MESSAGE_TYPE
= 33¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Unsubscribe
(request, subscription)[source]¶Bases: autobahn.wamp.message.Message
A WAMP UNSUBSCRIBE
message.
Format: [UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]
Parameters: |
---|
MESSAGE_TYPE
= 34¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Unsubscribed
(request)[source]¶Bases: autobahn.wamp.message.Message
A WAMP UNSUBSCRIBED
message.
Format: [UNSUBSCRIBED, UNSUBSCRIBE.Request|id]
Parameters: | request (int) – The request ID of the original UNSUBSCRIBE request. |
---|
MESSAGE_TYPE
= 35¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Event
(subscription, publication, args=None, kwargs=None, publisher=None)[source]¶Bases: autobahn.wamp.message.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]
Parameters: |
|
---|
MESSAGE_TYPE
= 36¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Call
(request, procedure, args=None, kwargs=None, timeout=None, receive_progress=None, discloseMe=None)[source]¶Bases: autobahn.wamp.message.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]
Parameters: |
|
---|
MESSAGE_TYPE
= 48¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Cancel
(request, mode=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP CANCEL
message.
Format: [CANCEL, CALL.Request|id, Options|dict]
Parameters: |
|
---|
MESSAGE_TYPE
= 49¶The WAMP message code for this type of message.
SKIP
= u'skip'¶ABORT
= u'abort'¶KILL
= u'kill'¶parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Result
(request, args=None, kwargs=None, progress=None)[source]¶Bases: autobahn.wamp.message.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]
Parameters: |
|
---|
MESSAGE_TYPE
= 50¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Register
(request, procedure, pkeys=None, discloseCaller=None, discloseCallerTransport=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP REGISTER
message.
Format: [REGISTER, Request|id, Options|dict, Procedure|uri]
Parameters: |
|
---|
MESSAGE_TYPE
= 64¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Registered
(request, registration)[source]¶Bases: autobahn.wamp.message.Message
A WAMP REGISTERED
message.
Format: [REGISTERED, REGISTER.Request|id, Registration|id]
Parameters: |
---|
MESSAGE_TYPE
= 65¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Unregister
(request, registration)[source]¶Bases: autobahn.wamp.message.Message
A WAMP UNREGISTER message.
Format: [UNREGISTER, Request|id, REGISTERED.Registration|id]
Parameters: |
---|
MESSAGE_TYPE
= 66¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Unregistered
(request)[source]¶Bases: autobahn.wamp.message.Message
A WAMP UNREGISTERED
message.
Format: [UNREGISTERED, UNREGISTER.Request|id]
Parameters: | request (int) – The request ID of the original UNREGISTER request. |
---|
MESSAGE_TYPE
= 67¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Invocation
(request, registration, args=None, kwargs=None, timeout=None, receive_progress=None, caller=None, caller_transport=None, authid=None, authrole=None, authmethod=None)[source]¶Bases: autobahn.wamp.message.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]
Parameters: |
|
---|
MESSAGE_TYPE
= 68¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Interrupt
(request, mode=None)[source]¶Bases: autobahn.wamp.message.Message
A WAMP INTERRUPT
message.
Format: [INTERRUPT, INVOCATION.Request|id, Options|dict]
Parameters: |
|
---|
MESSAGE_TYPE
= 69¶The WAMP message code for this type of message.
ABORT
= u'abort'¶KILL
= u'kill'¶parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.message.
Yield
(request, args=None, kwargs=None, progress=None)[source]¶Bases: autobahn.wamp.message.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]
Parameters: |
|
---|
MESSAGE_TYPE
= 70¶The WAMP message code for this type of message.
parse
(wmsg)[source]¶Verifies and parses an unserialized raw message into an actual WAMP message instance.
Parameters: | wmsg (list) – The unserialized raw message. |
---|---|
Returns: | An instance of this class. |
marshal
()[source]¶Implements autobahn.wamp.interfaces.IMessage.marshal()
autobahn.wamp.protocol.
Publication
(publicationId)[source]¶Object representing a publication.
This class implements autobahn.wamp.interfaces.IPublication
.
autobahn.wamp.protocol.
Subscription
(session, subscriptionId)[source]¶Object representing a subscription.
This class implements autobahn.wamp.interfaces.ISubscription
.
unsubscribe
()[source]¶Implements autobahn.wamp.interfaces.ISubscription.unsubscribe()
autobahn.wamp.protocol.
Registration
(session, registrationId)[source]¶Object representing a registration.
This class implements autobahn.wamp.interfaces.IRegistration
.
unregister
()[source]¶Implements autobahn.wamp.interfaces.IRegistration.unregister()
autobahn.wamp.protocol.
BaseSession
[source]¶WAMP session base class.
This class implements autobahn.wamp.interfaces.ISession
.
onJoin
(details)[source]¶Implements autobahn.wamp.interfaces.ISession.onJoin()
onLeave
(details)[source]¶Implements autobahn.wamp.interfaces.ISession.onLeave()
define
(exception, error=None)[source]¶Implements autobahn.wamp.interfaces.ISession.define()
autobahn.wamp.protocol.
ApplicationSession
(config=None)[source]¶Bases: autobahn.wamp.protocol.BaseSession
WAMP endpoint session. This class implements
autobahn.wamp.interfaces.IPublisher
autobahn.wamp.interfaces.ISubscriber
autobahn.wamp.interfaces.ICaller
autobahn.wamp.interfaces.ICallee
autobahn.wamp.interfaces.ITransportHandler
Constructor.
onOpen
(transport)[source]¶Implements autobahn.wamp.interfaces.ITransportHandler.onOpen()
join
(realm, authmethods=None, authid=None)[source]¶Implements autobahn.wamp.interfaces.ISession.join()
onMessage
(msg)[source]¶Implements autobahn.wamp.interfaces.ITransportHandler.onMessage()
onClose
(wasClean)[source]¶Implements autobahn.wamp.interfaces.ITransportHandler.onClose()
onJoin
(details)[source]¶Implements autobahn.wamp.interfaces.ISession.onJoin()
onLeave
(details)[source]¶Implements autobahn.wamp.interfaces.ISession.onLeave()
leave
(reason=None, log_message=None)[source]¶Implements autobahn.wamp.interfaces.ISession.leave()
call
(procedure, *args, **kwargs)[source]¶Implements autobahn.wamp.interfaces.ICaller.call()
register
(endpoint, procedure=None, options=None)[source]¶Implements autobahn.wamp.interfaces.ICallee.register()
autobahn.wamp.protocol.
ApplicationSessionFactory
(config=None)[source]¶WAMP endpoint session factory.
Parameters: | config (instance of autobahn.wamp.types.ComponentConfig ) – The default component configuration. |
---|
session
¶WAMP application session class to be used in this factory.
alias of ApplicationSession
autobahn.wamp.role.
RoleFeatures
[source]¶Bases: autobahn.util.EqualityMixin
ROLE
= None¶autobahn.wamp.role.
RoleBrokerFeatures
(subscriber_blackwhite_listing=None, publisher_exclusion=None, publication_trustlevels=None, pattern_based_subscription=None, subscriber_metaevents=None, subscriber_list=None, event_history=None, **kwargs)[source]¶Bases: autobahn.wamp.role.RoleCommonPubSubFeatures
ROLE
= u'broker'¶autobahn.wamp.role.
RoleSubscriberFeatures
(publication_trustlevels=None, pattern_based_subscription=None, subscriber_metaevents=None, subscriber_list=None, event_history=None, **kwargs)[source]¶Bases: autobahn.wamp.role.RoleCommonPubSubFeatures
ROLE
= u'subscriber'¶autobahn.wamp.role.
RolePublisherFeatures
(subscriber_blackwhite_listing=None, publisher_exclusion=None, **kwargs)[source]¶Bases: autobahn.wamp.role.RoleCommonPubSubFeatures
ROLE
= u'publisher'¶autobahn.wamp.role.
RoleDealerFeatures
(callee_blackwhite_listing=None, caller_exclusion=None, call_trustlevels=None, pattern_based_registration=None, **kwargs)[source]¶Bases: autobahn.wamp.role.RoleCommonRpcFeatures
ROLE
= u'dealer'¶autobahn.wamp.serializer.
Serializer
(serializer)[source]¶Base class for WAMP serializers. A WAMP serializer is the core glue between parsed WAMP message objects and the bytes on wire (the transport).
Constructor.
Parameters: | serializer (An object that implements autobahn.interfaces.IObjectSerializer .) – The object serializer to use for WAMP wire-level serialization. |
---|
MESSAGE_TYPE_MAP
= {1: <class autobahn.wamp.message.Hello at 0x7f803e0c1328>, 2: <class autobahn.wamp.message.Welcome at 0x7f803e0c1390>, 3: <class autobahn.wamp.message.Abort at 0x7f803e0c13f8>, 4: <class autobahn.wamp.message.Challenge at 0x7f803e0c1460>, 5: <class autobahn.wamp.message.Authenticate at 0x7f803e0c14c8>, 6: <class autobahn.wamp.message.Goodbye at 0x7f803e0c1530>, 7: <class autobahn.wamp.message.Heartbeat at 0x7f803e0c1598>, 8: <class autobahn.wamp.message.Error at 0x7f803e0c1600>, 16: <class autobahn.wamp.message.Publish at 0x7f803e0c1668>, 17: <class autobahn.wamp.message.Published at 0x7f803e0c16d0>, 32: <class autobahn.wamp.message.Subscribe at 0x7f803e0c1738>, 33: <class autobahn.wamp.message.Subscribed at 0x7f803e0c17a0>, 34: <class autobahn.wamp.message.Unsubscribe at 0x7f803e0c1808>, 35: <class autobahn.wamp.message.Unsubscribed at 0x7f803e0c1870>, 36: <class autobahn.wamp.message.Event at 0x7f803e0c18d8>, 48: <class autobahn.wamp.message.Call at 0x7f803e0c1940>, 49: <class autobahn.wamp.message.Cancel at 0x7f803e0c19a8>, 50: <class autobahn.wamp.message.Result at 0x7f803e0c1a10>, 64: <class autobahn.wamp.message.Register at 0x7f803e0c1a78>, 65: <class autobahn.wamp.message.Registered at 0x7f803e0c1ae0>, 66: <class autobahn.wamp.message.Unregister at 0x7f803e0c1b48>, 67: <class autobahn.wamp.message.Unregistered at 0x7f803e0c1bb0>, 68: <class autobahn.wamp.message.Invocation at 0x7f803e0c1c18>, 69: <class autobahn.wamp.message.Interrupt at 0x7f803e0c1c80>, 70: <class autobahn.wamp.message.Yield at 0x7f803e0c1ce8>}¶Mapping of WAMP message type codes to WAMP message classes.
unserialize
(payload, isBinary=None)[source]¶Implements autobahn.wamp.interfaces.ISerializer.unserialize()
autobahn.wamp.serializer.
JsonObjectSerializer
(batched=False)[source]¶Ctor.
Parameters: | batched (bool) – Flag that controls whether serializer operates in batched mode. |
---|
JSON_MODULE
= <module 'ujson' from '/usr/lib64/python2.7/site-packages/ujson.so'>¶The JSON module used (either stdib builtin or ujson).
BINARY
= False¶serialize
(obj)¶Implements autobahn.wamp.interfaces.IObjectSerializer.serialize()
unserialize
(payload)¶Implements autobahn.wamp.interfaces.IObjectSerializer.unserialize()
autobahn.wamp.serializer.
JsonSerializer
(batched=False)[source]¶Bases: autobahn.wamp.serializer.Serializer
Ctor.
Parameters: | batched (bool) – Flag to control whether to put this serialized into batched mode. |
---|
MIME_TYPE
= 'application/json'¶SERIALIZER_ID
= 'json'¶autobahn.wamp.serializer.
MsgPackObjectSerializer
(batched=False)[source]¶Ctor.
Parameters: | batched (bool) – Flag that controls whether serializer operates in batched mode. |
---|
BINARY
= True¶Flag that indicates whether this serializer needs a binary clean transport.
ENABLE_V5
= True¶Enable version 5 of the MsgPack specification (which differentiates between strings and binary).
serialize
(obj)¶Implements autobahn.wamp.interfaces.IObjectSerializer.serialize()
unserialize
(payload)¶Implements autobahn.wamp.interfaces.IObjectSerializer.unserialize()
autobahn.wamp.types.
ComponentConfig
(realm=None, extra=None)[source]¶WAMP application component configuration. An instance of this class is
provided to the constructor of autobahn.wamp.protocol.ApplicationSession
.
Parameters: |
|
---|
autobahn.wamp.types.
Accept
(authid=None, authrole=None, authmethod=None, authprovider=None)[source]¶Bases: autobahn.wamp.types.HelloReturn
Information to accept a HELLO
.
Parameters: |
|
---|
autobahn.wamp.types.
Deny
(reason=u'wamp.error.not_authorized', message=None)[source]¶Bases: autobahn.wamp.types.HelloReturn
Information to deny a HELLO
.
Parameters: |
|
---|
autobahn.wamp.types.
Challenge
(method, extra=None)[source]¶Bases: autobahn.wamp.types.HelloReturn
Information to challenge the client upon HELLO
.
Parameters: |
|
---|
autobahn.wamp.types.
HelloDetails
(roles=None, authmethods=None, authid=None, pending_session=None)[source]¶Provides details of a WAMP session while still attaching.
Parameters: |
|
---|
autobahn.wamp.types.
SessionDetails
(realm, session, authid=None, authrole=None, authmethod=None, authprovider=None)[source]¶Provides details for a WAMP session upon open.
Ctor.
Parameters: |
|
---|
autobahn.wamp.types.
CloseDetails
(reason=None, message=None)[source]¶Provides details for a WAMP session upon open.
Parameters: |
|
---|
autobahn.wamp.types.
SubscribeOptions
(match=None, details_arg=None)[source]¶Used to provide options for subscribing in
autobahn.wamp.interfaces.ISubscriber.subscribe()
.
Parameters: |
|
---|
autobahn.wamp.types.
EventDetails
(publication, publisher=None)[source]¶Provides details on an event when calling an event handler previously registered.
Ctor.
Parameters: |
---|
autobahn.wamp.types.
PublishOptions
(acknowledge=None, excludeMe=None, exclude=None, eligible=None, discloseMe=None)[source]¶Used to provide options for subscribing in
autobahn.wamp.interfaces.IPublisher.publish()
.
Parameters: |
|
---|
autobahn.wamp.types.
RegisterOptions
(details_arg=None, pkeys=None, discloseCaller=None, discloseCallerTransport=None)[source]¶Used to provide options for registering in
autobahn.wamp.interfaces.ICallee.register()
.
Parameters: | details_arg (str) – When invoking the endpoint, provide call details in this keyword argument to the callable. |
---|
autobahn.wamp.types.
CallDetails
(progress=None, caller=None, caller_transport=None, authid=None, authrole=None, authmethod=None)[source]¶Provides details on a call when an endpoint previously registered is being called and opted to receive call details.
Ctor.
Parameters: |
|
---|
autobahn.wamp.types.
CallOptions
(onProgress=None, timeout=None, discloseMe=None, runOn=None)[source]¶Used to provide options for calling with autobahn.wamp.interfaces.ICaller.call()
.
Parameters: |
|
---|
autobahn.wamp.uri.
Pattern
(uri, target)[source]¶A WAMP URI Pattern.
Parameters: |
|
---|
URI_TARGET_ENDPOINT
= 1¶URI_TARGET_HANDLER
= 2¶URI_TARGET_EXCEPTION
= 3¶URI_TYPE_EXACT
= 1¶URI_TYPE_PREFIX
= 2¶URI_TYPE_WILDCARD
= 3¶uri
()[source]¶Returns the original URI (pattern) for this pattern.
Returns: | The URI (pattern), e.g. "com.myapp.product.<product:int>.update" . |
---|---|
Return type: | unicode |
match
(uri)[source]¶Match the given (fully qualified) URI according to this pattern and return extracted args and kwargs.
Parameters: | uri (unicode) – The URI to match, e.g. "com.myapp.product.123456.update" . |
---|---|
Returns: | A tuple (args, kwargs) |
Return type: | tuple |
is_endpoint
()[source]¶Check if this pattern is for a procedure endpoint.
Returns: | True , iff this pattern is for a procedure endpoint. |
---|---|
Return type: | bool |
autobahn.wamp.websocket.
WampWebSocketServerProtocol
[source]¶Bases: autobahn.wamp.websocket.WampWebSocketProtocol
Mixin for WAMP-over-WebSocket server transports.
STRICT_PROTOCOL_NEGOTIATION
= True¶onConnect
(request)[source]¶Callback from autobahn.websocket.interfaces.IWebSocketChannel.onConnect()
autobahn.wamp.websocket.
WampWebSocketClientProtocol
[source]¶Bases: autobahn.wamp.websocket.WampWebSocketProtocol
Mixin for WAMP-over-WebSocket client transports.
STRICT_PROTOCOL_NEGOTIATION
= True¶onConnect
(response)[source]¶Callback from autobahn.websocket.interfaces.IWebSocketChannel.onConnect()
autobahn.wamp.websocket.
WampWebSocketServerFactory
(factory, serializers=None, debug_wamp=False)[source]¶Bases: autobahn.wamp.websocket.WampWebSocketFactory
Mixin for WAMP-over-WebSocket server transport factories.
Ctor.
Parameters: |
|
---|
autobahn.wamp.websocket.
WampWebSocketClientFactory
(factory, serializers=None, debug_wamp=False)[source]¶Bases: autobahn.wamp.websocket.WampWebSocketFactory
Mixin for WAMP-over-WebSocket client transport factories.
Ctor.
Parameters: |
|
---|