autobahn.wamp

Submodules

autobahn.wamp.auth

autobahn.wamp.auth.generate_totp_secret(length=10)[source]

Generates a new Base32 encoded, random secret.

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:
  • secret (bytes) – Base32 encoded secret.
  • offset (int) – Time offset for which to compute TOTP.
Returns:

TOTP for current time (+/- offset).

Return type:

bytes

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:
  • data (bytes) – The data for which to compute the PBKDF2 derived key.
  • salt (bytes) – The salt to use for deriving the key.
  • iterations (int) – The number of iterations to perform in PBKDF2.
  • keylen (int) – The length of the cryptographic key to derive.
  • hashfunc (callable) – The hash function to use, e.g. hashlib.sha1.
Returns:

The derived cryptographic key.

Return type:

bytes

autobahn.wamp.auth.derive_key(secret, salt, iterations=1000, keylen=32)[source]

Computes a derived cryptographic key from a password according to PBKDF2.

Parameters:
  • secret (bytes) – The secret.
  • salt (bytes) – The salt to be used.
  • iterations (int) – Number of iterations of derivation algorithm to run.
  • keylen (int) – Length of the key to derive in bits.
Returns:

The derived key in Base64 encoding.

Return type:

bytes

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

  • upper and lower case latin letters
  • digits
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.auth.compute_wcs(key, challenge)[source]

Compute an WAMP-CRA authentication signature from an authentication challenge and a (derived) key.

Parameters:
  • key (bytes) – The key derived (via PBKDF2) from the secret.
  • challenge (bytes) – The authentication challenge to sign.
Returns:

The authentication signature.

Return type:

bytes

autobahn.wamp.exception

exception 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).
exception 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).
exception 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).
exception 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).
exception 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.

exception 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).

exception autobahn.wamp.exception.NotAuthorized[source]

Bases: exceptions.Exception

Not authorized to perform the respective action.

exception autobahn.wamp.exception.InvalidUri[source]

Bases: exceptions.Exception

The URI for a topic, procedure or error is not a valid WAMP URI.

autobahn.wamp.interfaces

class 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.

serialize(obj)[source]

Serialize an object to a byte string.

Parameters:obj (Any serializable type.) – Object to serialize.
Returns:bytes – Serialized byte string.
unserialize(payload)[source]

Unserialize objects from a byte string.

Parameters:payload (bytes) – Objects to unserialize.
Returns:list – List of (raw) objects unserialized.
class 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.
uncache()[source]

Resets the serialization cache.

class 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.
class 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.
close()[source]

Close the transport regularly. The transport will perform any closing handshake if applicable. This should be used for any application initiated closing.

abort()[source]

Abort the transport abruptly. The transport will be destroyed as fast as possible, and without playing nice to the peer. This should only be used in case of fatal errors, protocol violations or possible detected attacks.

class 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
onClose(wasClean)

Callback fired when the transport has been closed.

Parameters:wasClean (bool) – Indicates if the transport has been closed regularly.
class 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.
leave(reason=None, message=None)[source]

Actively close this WAMP session.

Parameters:
  • reason (str) – An optional URI for the closing reason.
  • message (str) – An optional (human readable) closing message, intended for logging purposes.
onLeave(details)[source]

Callback fired when WAMP session has is closed

Parameters:details (Instance of autobahn.wamp.types.CloseDetails.) – Close information.
disconnect()[source]

Close the underlying transport.

onDisconnect()[source]

Callback fired when underlying transport has been closed.

define(exception, error=None)[source]

Defines an exception for a WAMP error in the context of this WAMP session.

Parameters:
  • exception (A class that derives of Exception.) – The exception class to define an error mapping for.
  • error (str) – The URI (or URI pattern) the exception class should be mapped for. Iff the exception class is decorated, this must be None.
class 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.

  • If the result is a single positional return value, it’ll be returned “as-is”.
  • If the result contains multiple positional return values or keyword return values, the result is wrapped in an instance of autobahn.wamp.types.CallResult.
  • If the call fails, the returned Deferred/Future will be rejected with an instance of 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:
  • procedure (unicode) – The URI of the remote procedure to be called, e.g. u"com.myapp.hello".
  • args (list) – Any positional arguments for the call.
  • kwargs (dict) – Any keyword arguments for the call.
Returns:

A Deferred/Future for the call result -

Return type:

instance of twisted.internet.defer.Deferred / asyncio.Future

class 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).

  • If the unregistration succeeds, the returned Deferred/Future will resolve (with no return value).
  • If the unregistration fails, the returned Deferred/Future will be rejected with an instance of autobahn.wamp.exception.ApplicationError.
Returns:A Deferred/Future for the unregistration
Return type:instance(s) of twisted.internet.defer.Deferred / asyncio.Future
class 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.

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:
  • endpoint (callable or object) – The endpoint called under the procedure.
  • procedure (unicode) – When endpoint is a callable, the URI (or URI pattern) of the procedure to register for. When endpoint is an object, the argument is ignored (and should be None).
  • options (instance of autobahn.wamp.types.RegisterOptions.) – Options for registering.
Returns:

A registration or a list of registrations (or errors)

Return type:

instance(s) of twisted.internet.defer.Deferred / asyncio.Future

class 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.

class 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:

Parameters:
  • topic (unicode) – The URI of the topic to publish to, e.g. u"com.myapp.mytopic1".
  • args (list) – Arbitrary application payload for the event (positional arguments).
  • kwargs (dict) – Arbitrary application payload for the event (keyword arguments).
Returns:

Acknowledgement for acknowledge publications - otherwise nothing.

Return type:

None or instance of twisted.internet.defer.Deferred / asyncio.Future

class 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).

  • If the unsubscription succeeds, the returned Deferred/Future will resolve (with no return value).
  • If the unsubscription fails, the returned Deferred/Future will reject with an instance of autobahn.wamp.exception.ApplicationError.
Returns:A Deferred/Future for the unsubscription
Return type:instance(s) of twisted.internet.defer.Deferred / asyncio.Future
class 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.

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:
  • handler (callable or object) – The event handler to receive events.
  • topic (unicode) – When handler is a callable, the URI (or URI pattern) of the topic to subscribe to. When handler is an object, this value is ignored (and should be None).
  • options (An instance of autobahn.wamp.types.SubscribeOptions.) – Options for subscribing.
Returns:

A single Deferred/Future or a list of such objects

Return type:

instance(s) of twisted.internet.defer.Deferred / asyncio.Future

autobahn.wamp.message

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:
  • value (unicode) – The value to check.
  • message (unicode) – Prefix for message in exception raised when value is invalid.
  • strict (bool) – If True, do a strict check on the URI (the WAMP spec SHOULD behavior).
  • allowEmptyComponents (bool) – If True, allow empty URI components (for pattern based subscriptions and registrations).
Returns:

The URI value (if valid).

Return type:

unicode

Raises:

instance of autobahn.wamp.exception.ProtocolError

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:
  • value (int) – The value to check.
  • message (unicode) – Prefix for message in exception raised when value is invalid.
Returns:

The ID value (if valid).

Return type:

int

Raises:

instance of autobahn.wamp.exception.ProtocolError

class 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()

serialize(serializer)[source]

Implements autobahn.wamp.interfaces.IMessage.serialize()

class 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:
  • realm (unicode) – The URI of the WAMP realm to join.
  • roles (list of autobahn.wamp.role.RoleFeatures) – The WAMP roles to announce.
  • authmethods (list of unicode or None) – The authentication methods to announce.
  • authid (unicode or None) – The authentication ID to announce.
MESSAGE_TYPE = 1

The WAMP message code for this type of message.

static 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()

class 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:
  • session (int) – The WAMP session ID the other peer is assigned.
  • roles (list of autobahn.wamp.role.RoleFeatures) – The WAMP roles to announce.
  • authid (unicode or None) – The authentication ID assigned.
  • authrole (unicode or None) – The authentication role assigned.
  • authmethod (unicode or None) – The authentication method in use.
  • authprovider (unicode or None) – The authentication method in use.
MESSAGE_TYPE = 2

The WAMP message code for this type of message.

static 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()

class autobahn.wamp.message.Abort(reason, message=None)[source]

Bases: autobahn.wamp.message.Message

A WAMP ABORT message.

Format: [ABORT, Details|dict, Reason|uri]

Parameters:
  • reason (unicode) – WAMP or application error URI for aborting reason.
  • message (unicode or None) – Optional human-readable closing message, e.g. for logging purposes.
MESSAGE_TYPE = 3

The WAMP message code for this type of message.

static 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()

class autobahn.wamp.message.Challenge(method, extra=None)[source]

Bases: autobahn.wamp.message.Message

A WAMP CHALLENGE message.

Format: [CHALLENGE, Method|string, Extra|dict]

Parameters:
  • method (unicode) – The authentication method.
  • extra (dict or None) – Authentication method specific information.
MESSAGE_TYPE = 4

The WAMP message code for this type of message.

static 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()

class autobahn.wamp.message.Authenticate(signature, extra=None)[source]

Bases: autobahn.wamp.message.Message

A WAMP AUTHENTICATE message.

Format: [AUTHENTICATE, Signature|string, Extra|dict]

Parameters:
  • signature (unicode) – The signature for the authentication challenge.
  • extra (dict or None) – Authentication method specific information.
MESSAGE_TYPE = 5

The WAMP message code for this type of message.

static 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()

class 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:
  • reason (unicode) – Optional WAMP or application error URI for closing reason.
  • message (unicode or None) – Optional human-readable closing message, e.g. for logging purposes.
MESSAGE_TYPE = 6

The WAMP message code for this type of message.

DEFAULT_REASON = u'wamp.goodbye.normal'

Default WAMP closing reason.

static 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()

class 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:
  • incoming (int) – Last incoming heartbeat processed from peer.
  • outgoing (int) – Outgoing heartbeat.
  • discard (unicode or None) – Optional data that is discarded by peer.
MESSAGE_TYPE = 7

The WAMP message code for this type of message.

static 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()

class 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:
  • request_type (int) – The WAMP message type code for the original request.
  • request (int) – The WAMP request ID of the original request (Call, Subscribe, ...) this error occurred for.
  • error (unicode) – The WAMP or application error URI for the error that occurred.
  • args (list or None) – Positional values for application-defined exception. Must be serializable using any serializers in use.
  • kwargs (dict or None) – Keyword values for application-defined exception. Must be serializable using any serializers in use.
MESSAGE_TYPE = 8

The WAMP message code for this type of message.

static 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()

class 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:
  • request (int) – The WAMP request ID of this request.
  • topic (unicode) – The WAMP or application URI of the PubSub topic the event should be published to.
  • args (list or tuple or None) – Positional values for application-defined event payload. Must be serializable using any serializers in use.
  • kwargs (dict or None) – Keyword values for application-defined event payload. Must be serializable using any serializers in use.
  • acknowledge (bool or None) – If True, acknowledge the publication with a success or error response.
  • excludeMe (bool or None) – If True, exclude the publisher from receiving the event, even if he is subscribed (and eligible).
  • exclude (list of int or None) – List of WAMP session IDs to exclude from receiving this event.
  • eligible (list of int or None) – List of WAMP session IDs eligible to receive this event.
  • discloseMe (bool or None) – If True, request to disclose the publisher of this event to subscribers.
MESSAGE_TYPE = 16

The WAMP message code for this type of message.

static 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()

class autobahn.wamp.message.Published(request, publication)[source]

Bases: autobahn.wamp.message.Message

A WAMP PUBLISHED message.

Format: [PUBLISHED, PUBLISH.Request|id, Publication|id]

Parameters:
  • request (int) – The request ID of the original PUBLISH request.
  • publication (int) – The publication ID for the published event.
MESSAGE_TYPE = 17

The WAMP message code for this type of message.

static 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()

class 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:
  • request (int) – The WAMP request ID of this request.
  • topic (unicode) – The WAMP or application URI of the PubSub topic to subscribe to.
  • match (unicode) – The topic matching method to be used for the subscription.
MESSAGE_TYPE = 32

The WAMP message code for this type of message.

MATCH_EXACT = u'exact'
MATCH_PREFIX = u'prefix'
MATCH_WILDCARD = u'wildcard'
static 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()

class autobahn.wamp.message.Subscribed(request, subscription)[source]

Bases: autobahn.wamp.message.Message

A WAMP SUBSCRIBED message.

Format: [SUBSCRIBED, SUBSCRIBE.Request|id, Subscription|id]

Parameters:
  • request (int) – The request ID of the original SUBSCRIBE request.
  • subscription (int) – The subscription ID for the subscribed topic (or topic pattern).
MESSAGE_TYPE = 33

The WAMP message code for this type of message.

static 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()

class autobahn.wamp.message.Unsubscribe(request, subscription)[source]

Bases: autobahn.wamp.message.Message

A WAMP UNSUBSCRIBE message.

Format: [UNSUBSCRIBE, Request|id, SUBSCRIBED.Subscription|id]

Parameters:
  • request (int) – The WAMP request ID of this request.
  • subscription (int) – The subscription ID for the subscription to unsubscribe from.
MESSAGE_TYPE = 34

The WAMP message code for this type of message.

static 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()

class 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.

static 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()

class 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:
  • subscription (int) – The subscription ID this event is dispatched under.
  • publication (int) – The publication ID of the dispatched event.
  • args (list or tuple or None) – Positional values for application-defined exception. Must be serializable using any serializers in use.
  • kwargs (dict or None) – Keyword values for application-defined exception. Must be serializable using any serializers in use.
  • publisher (int or None) – If present, the WAMP session ID of the publisher of this event.
MESSAGE_TYPE = 36

The WAMP message code for this type of message.

static 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()

class 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:
  • request (int) – The WAMP request ID of this request.
  • procedure (unicode) – The WAMP or application URI of the procedure which should be called.
  • args (list or tuple or None) – Positional values for application-defined call arguments. Must be serializable using any serializers in use.
  • kwargs (dict or None) – Keyword values for application-defined call arguments. Must be serializable using any serializers in use.
  • timeout (int or None) – If present, let the callee automatically cancel the call after this ms.
  • receive_progress (bool or None) – If True, indicates that the caller wants to receive progressive call results.
  • discloseMe (bool or None) – If True, the caller requests to disclose itself to the callee.
MESSAGE_TYPE = 48

The WAMP message code for this type of message.

static 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()

class 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:
  • request (int) – The WAMP request ID of the original CALL to cancel.
  • mode (unicode or None) – Specifies how to cancel the call ("skip", "abort" or "kill").
MESSAGE_TYPE = 49

The WAMP message code for this type of message.

SKIP = u'skip'
ABORT = u'abort'
KILL = u'kill'
static 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()

class 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:
  • request (int) – The request ID of the original CALL request.
  • args (list or tuple or None) – Positional values for application-defined event payload. Must be serializable using any serializers in use.
  • kwargs (dict or None) – Keyword values for application-defined event payload. Must be serializable using any serializers in use.
  • progress (bool or None) – If True, this result is a progressive call result, and subsequent results (or a final error) will follow.
MESSAGE_TYPE = 50

The WAMP message code for this type of message.

static 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()

class 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:
  • request (int) – The WAMP request ID of this request.
  • procedure (unicode) – The WAMP or application URI of the RPC endpoint provided.
  • pkeys (list of int or None) – The endpoint can work for this list of application partition keys.
  • discloseCaller (bool or None) – If True, the (registering) callee requests to disclose the identity of callers whenever called.
  • discloseCallerTransport (bool) – If True, the (registering) calle requests to disclose transport level information of caller whenever called. This only takes effect if discloseCaller == True.
MESSAGE_TYPE = 64

The WAMP message code for this type of message.

static 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()

class autobahn.wamp.message.Registered(request, registration)[source]

Bases: autobahn.wamp.message.Message

A WAMP REGISTERED message.

Format: [REGISTERED, REGISTER.Request|id, Registration|id]

Parameters:
  • request (int) – The request ID of the original REGISTER request.
  • registration (int) – The registration ID for the registered procedure (or procedure pattern).
MESSAGE_TYPE = 65

The WAMP message code for this type of message.

static 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()

class autobahn.wamp.message.Unregister(request, registration)[source]

Bases: autobahn.wamp.message.Message

A WAMP UNREGISTER message.

Format: [UNREGISTER, Request|id, REGISTERED.Registration|id]

Parameters:
  • request (int) – The WAMP request ID of this request.
  • registration (int) – The registration ID for the registration to unregister.
MESSAGE_TYPE = 66

The WAMP message code for this type of message.

static 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()

class 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.

static 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()

class 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:
  • request (int) – The WAMP request ID of this request.
  • registration (int) – The registration ID of the endpoint to be invoked.
  • args (list or tuple or None) – Positional values for application-defined event payload. Must be serializable using any serializers in use.
  • kwargs (dict or None) – Keyword values for application-defined event payload. Must be serializable using any serializers in use.
  • timeout (int or None) – If present, let the callee automatically cancels the invocation after this ms.
  • receive_progress (bool or None) – Indicates if the callee should produce progressive results.
  • caller (int or None) – The WAMP session ID of the caller.
  • caller_transport (dict or None) – WAMP transport level information of the caller.
  • authid (unicode or None) – The authentication ID of the caller.
  • authrole (unicode or None) – The authentication role of the caller.
  • authmethod (unicode or None) – The authentication method under which the caller was authenticated.
MESSAGE_TYPE = 68

The WAMP message code for this type of message.

static 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()

class 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:
  • request (int) – The WAMP request ID of the original INVOCATION to interrupt.
  • mode (unicode or None) – Specifies how to interrupt the invocation ("abort" or "kill").
MESSAGE_TYPE = 69

The WAMP message code for this type of message.

ABORT = u'abort'
KILL = u'kill'
static 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()

class 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:
  • request (int) – The WAMP request ID of the original call.
  • args (list or tuple or None) – Positional values for application-defined event payload. Must be serializable using any serializers in use.
  • kwargs (dict or None) – Keyword values for application-defined event payload. Must be serializable using any serializers in use.
  • progress (bool or None) – If True, this result is a progressive invocation result, and subsequent results (or a final error) will follow.
MESSAGE_TYPE = 70

The WAMP message code for this type of message.

static 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

class autobahn.wamp.protocol.Endpoint(obj, fn, procedure, options=None)[source]
class autobahn.wamp.protocol.Handler(obj, fn, topic, details_arg=None)[source]
class autobahn.wamp.protocol.Publication(publicationId)[source]

Object representing a publication. This class implements autobahn.wamp.interfaces.IPublication.

class 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()

class 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()

class autobahn.wamp.protocol.BaseSession[source]

WAMP session base class.

This class implements autobahn.wamp.interfaces.ISession.

onConnect()[source]

Implements autobahn.wamp.interfaces.ISession.onConnect()

onJoin(details)[source]

Implements autobahn.wamp.interfaces.ISession.onJoin()

onLeave(details)[source]

Implements autobahn.wamp.interfaces.ISession.onLeave()

onDisconnect()[source]

Implements autobahn.wamp.interfaces.ISession.onDisconnect()

define(exception, error=None)[source]

Implements autobahn.wamp.interfaces.ISession.define()

class autobahn.wamp.protocol.ApplicationSession(config=None)[source]

Bases: autobahn.wamp.protocol.BaseSession

WAMP endpoint session. This class implements

Constructor.

onOpen(transport)[source]

Implements autobahn.wamp.interfaces.ITransportHandler.onOpen()

onConnect()[source]

Implements autobahn.wamp.interfaces.ISession.onConnect()

join(realm, authmethods=None, authid=None)[source]

Implements autobahn.wamp.interfaces.ISession.join()

disconnect()[source]

Implements autobahn.wamp.interfaces.ISession.disconnect()

onMessage(msg)[source]

Implements autobahn.wamp.interfaces.ITransportHandler.onMessage()

onClose(wasClean)[source]

Implements autobahn.wamp.interfaces.ITransportHandler.onClose()

onChallenge(challenge)[source]

Implements autobahn.wamp.interfaces.ISession.onChallenge()

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()

publish(topic, *args, **kwargs)[source]

Implements autobahn.wamp.interfaces.IPublisher.publish()

subscribe(handler, topic=None, options=None)[source]

Implements autobahn.wamp.interfaces.ISubscriber.subscribe()

call(procedure, *args, **kwargs)[source]

Implements autobahn.wamp.interfaces.ICaller.call()

register(endpoint, procedure=None, options=None)[source]

Implements autobahn.wamp.interfaces.ICallee.register()

class 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

class autobahn.wamp.role.RoleFeatures[source]

Bases: autobahn.util.EqualityMixin

ROLE = None
class 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'
class 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'
class autobahn.wamp.role.RolePublisherFeatures(subscriber_blackwhite_listing=None, publisher_exclusion=None, **kwargs)[source]

Bases: autobahn.wamp.role.RoleCommonPubSubFeatures

ROLE = u'publisher'
class 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'
class autobahn.wamp.role.RoleCallerFeatures(callee_blackwhite_listing=None, caller_exclusion=None, **kwargs)[source]

Bases: autobahn.wamp.role.RoleCommonRpcFeatures

ROLE = u'caller'
class autobahn.wamp.role.RoleCalleeFeatures(call_trustlevels=None, pattern_based_registration=None, **kwargs)[source]

Bases: autobahn.wamp.role.RoleCommonRpcFeatures

ROLE = u'callee'

autobahn.wamp.serializer

class 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.

serialize(msg)[source]

Implements autobahn.wamp.interfaces.ISerializer.serialize()

unserialize(payload, isBinary=None)[source]

Implements autobahn.wamp.interfaces.ISerializer.unserialize()

class 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()

class 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'
class 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()

class autobahn.wamp.serializer.MsgPackSerializer(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/x-msgpack'
SERIALIZER_ID = 'msgpack'

autobahn.wamp.types

class 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:
  • realm (unicode) – The realm the session should join.
  • extra (dict) – Optional dictionary with extra configuration.
class autobahn.wamp.types.HelloReturn[source]

Base class for HELLO return information.

class autobahn.wamp.types.Accept(authid=None, authrole=None, authmethod=None, authprovider=None)[source]

Bases: autobahn.wamp.types.HelloReturn

Information to accept a HELLO.

Parameters:
  • authid (unicode) – The authentication ID the client is assigned, e.g. "joe" or "joe@example.com".
  • authrole (unicode) – The authentication role the client is assigned, e.g. "anonymous", "user" or "com.myapp.user".
  • authmethod (unicode) – The authentication method that was used to authenticate the client, e.g. "cookie" or "wampcra".
  • authprovider (unicode) – The authentication provider that was used to authenticate the client, e.g. "mozilla-persona".
class autobahn.wamp.types.Deny(reason=u'wamp.error.not_authorized', message=None)[source]

Bases: autobahn.wamp.types.HelloReturn

Information to deny a HELLO.

Parameters:
  • reason (unicode) – The reason of denying the authentication (an URI, e.g. wamp.error.not_authorized)
  • message (unicode) – A human readable message (for logging purposes).
class autobahn.wamp.types.Challenge(method, extra=None)[source]

Bases: autobahn.wamp.types.HelloReturn

Information to challenge the client upon HELLO.

Parameters:
  • method (unicode) – The authentication method for the challenge (e.g. "wampcra").
  • extra (dict) – Any extra information for the authentication challenge. This is specific to the authentication method.
class autobahn.wamp.types.HelloDetails(roles=None, authmethods=None, authid=None, pending_session=None)[source]

Provides details of a WAMP session while still attaching.

Parameters:
  • roles (dict) – The WAMP roles and features supported by the attaching client.
  • authmethods (list) – The authentication methods the client is willing to perform.
  • authid (str) – The authentication ID the client wants to authenticate as. Required for WAMP-CRA.
  • pending_session (int) – The session ID the session will get once successfully attached.
class 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:
  • realm (unicode) – The realm this WAMP session is attached to.
  • session (int) – WAMP session ID of this session.
class autobahn.wamp.types.CloseDetails(reason=None, message=None)[source]

Provides details for a WAMP session upon open.

Parameters:
  • reason (unicode) – The close reason (an URI, e.g. wamp.close.normal)
  • message (unicode) – Closing log message.
class autobahn.wamp.types.SubscribeOptions(match=None, details_arg=None)[source]

Used to provide options for subscribing in autobahn.wamp.interfaces.ISubscriber.subscribe().

Parameters:
  • match (unicode) – The topic matching method to be used for the subscription.
  • details_arg (str) – When invoking the handler, provide event details in this keyword argument to the callable.
class autobahn.wamp.types.EventDetails(publication, publisher=None)[source]

Provides details on an event when calling an event handler previously registered.

Ctor.

Parameters:
  • publication (int) – The publication ID of the event (always present).
  • publisher (int) – The WAMP session ID of the original publisher of this event.
class 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:
  • acknowledge (bool) – If True, acknowledge the publication with a success or error response.
  • excludeMe (bool) – If True, exclude the publisher from receiving the event, even if he is subscribed (and eligible).
  • exclude (list of int) – List of WAMP session IDs to exclude from receiving this event.
  • eligible (list of int) – List of WAMP session IDs eligible to receive this event.
  • discloseMe (bool) – If True, request to disclose the publisher of this event to subscribers.
class 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.
class 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:
  • progress (callable) – A callable that will receive progressive call results.
  • caller (int) – The WAMP session ID of the caller, if the latter is disclosed.
  • caller_transport (dict or None) – Information from the WAMP transport of the caller.
  • authid (str) – The authentication ID of the caller.
  • authrole (str) – The authentication role of the caller.
class 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:
  • onProgress (callable) – A callback that will be called when the remote endpoint called yields interim call progress results.
  • timeout (float) – Time in seconds after which the call should be automatically canceled.
  • discloseMe (bool) – Request to disclose the identity of the caller (it’s WAMP session ID) to Callees. Note that a Dealer, depending on Dealer configuration, might reject the request, or might disclose the Callee’s identity without a request to do so.
  • runOn (str) – If present, indicates a distributed call. Distributed calls allows to run a call issued by a Caller on one or more endpoints implementing the called procedure. Permissible value are: "all", "any" and "partition". If runOne == "partition", then runPartitions MUST be present.
class autobahn.wamp.types.CallResult(*results, **kwresults)[source]

Wrapper for remote procedure call results that contain multiple positional return values or keyword return values.

Constructor.

Parameters:
  • results (list) – The positional result values.
  • kwresults (dict) – The keyword result values.

autobahn.wamp.uri

class autobahn.wamp.uri.Pattern(uri, target)[source]

A WAMP URI Pattern.

Parameters:
  • uri (unicode) – The URI or URI pattern, e.g. "com.myapp.product.<product:int>.update".
  • target (callable or obj) – The target for this pattern: a procedure endpoint (a callable), an event handler (a callable) or an exception (a class).
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
is_handler()[source]

Check if this pattern is for an event handler.

Returns:True, iff this pattern is for an event handler.
Return type:bool
is_exception()[source]

Check if this pattern is for an exception.

Returns:True, iff this pattern is for an exception.
Return type:bool

autobahn.wamp.websocket

class 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()

class 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()

class 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:
class 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:

Module contents

autobahn.wamp.register(uri)[source]

Decorator for WAMP procedure endpoints.

autobahn.wamp.subscribe(uri)[source]

Decorator for WAMP event handlers.

autobahn.wamp.error(uri)[source]

Decorator for WAMP error classes.

Reactive Manifesto: We are reactive banner