autobahn.wamp.types


Module Contents

Classes

Subscription

Object representing a handler subscription.

Registration

Object representing a registration.

Publication

Object representing a publication (feedback from publishing an event when doing

ComponentConfig

WAMP application component configuration. An instance of this class is

HelloReturn

Base class for HELLO return information.

Accept

Information to accept a HELLO.

Deny

Information to deny a HELLO.

Challenge

Information to challenge the client upon HELLO.

HelloDetails

Provides details of a WAMP session while still attaching.

SessionIdent

WAMP session identification information.

CloseDetails

Provides details for a WAMP session upon close.

SubscribeOptions

Used to provide options for subscribing in

EventDetails

Provides details on an event when calling an event handler

PublishOptions

Used to provide options for subscribing in

RegisterOptions

Used to provide options for registering in

CallDetails

Provides details on a call when an endpoint previously

CallOptions

Used to provide options for calling with autobahn.wamp.interfaces.ICaller.call().

CallResult

Wrapper for remote procedure call results that contain multiple positional

EncodedPayload

Wrapper holding an encoded application payload when using WAMP payload transparency.

TransportDetails

Details about a WAMP transport used for carrying a WAMP session. WAMP can be communicated

SessionDetails

Provides details for a WAMP session upon open.

class autobahn.wamp.types.ComponentConfig(realm=None, extra=None, keyring=None, controller=None, shared=None, runner=None)[source]

Bases: object

WAMP application component configuration. An instance of this class is provided to the constructor of autobahn.wamp.protocol.ApplicationSession.

__slots__ = ['realm', 'extra', 'keyring', 'controller', 'shared', 'runner']
__str__()[source]

Return str(self).

class autobahn.wamp.types.HelloReturn[source]

Bases: object

Base class for HELLO return information.

class autobahn.wamp.types.Accept(realm: Optional[str] = None, authid: Optional[str] = None, authrole: Optional[str] = None, authmethod: Optional[str] = None, authprovider: Optional[str] = None, authextra: Optional[Dict[str, Any]] = None)[source]

Bases: HelloReturn

Information to accept a HELLO.

__slots__ = ['realm', 'authid', 'authrole', 'authmethod', 'authprovider', 'authextra']
__str__()[source]

Return str(self).

class autobahn.wamp.types.Deny(reason='wamp.error.not_authorized', message=None)[source]

Bases: HelloReturn

Information to deny a HELLO.

__slots__ = ['reason', 'message']
__str__()[source]

Return str(self).

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

Bases: HelloReturn

Information to challenge the client upon HELLO.

__slots__ = ['method', 'extra']
__str__()[source]

Return str(self).

class autobahn.wamp.types.HelloDetails(realm=None, authmethods=None, authid=None, authrole=None, authextra=None, session_roles=None, pending_session=None, resumable=None, resume_session=None, resume_token=None)[source]

Bases: object

Provides details of a WAMP session while still attaching.

__slots__ = ['realm', 'authmethods', 'authid', 'authrole', 'authextra', 'session_roles', 'pending_session',...
__str__()[source]

Return str(self).

class autobahn.wamp.types.SessionIdent(session=None, authid=None, authrole=None)[source]

Bases: object

WAMP session identification information.

A WAMP session joined on a realm on a WAMP router is identified technically by its session ID (session) already.

The permissions the session has are tied to the WAMP authentication role (authrole).

The subject behind the session, eg the user or the application component is identified by the WAMP authentication ID (authid). One session is always authenticated under/as one specific authid, but a given authid might have zero, one or many sessions joined on a router at the same time.

__slots__ = ['session', 'authid', 'authrole']
__str__()[source]

Return str(self).

marshal()[source]
static from_calldetails(call_details)[source]

Create a new session identification object from the caller information in the call details provided.

Parameters

call_details (autobahn.wamp.types.CallDetails) – Details of a WAMP call.

Returns

New session identification object.

Return type

autobahn.wamp.types.SessionIdent

static from_eventdetails(event_details)[source]

Create a new session identification object from the publisher information in the event details provided.

Parameters

event_details (autobahn.wamp.types.EventDetails) – Details of a WAMP event.

Returns

New session identification object.

Return type

autobahn.wamp.types.SessionIdent

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

Bases: object

Provides details for a WAMP session upon close.

REASON_DEFAULT = wamp.close.normal
REASON_TRANSPORT_LOST = wamp.close.transport_lost
__slots__ = ['reason', 'message']
marshal()[source]
__str__()[source]

Return str(self).

class autobahn.wamp.types.SubscribeOptions(match=None, details=None, details_arg=None, forward_for=None, get_retained=None, correlation_id=None, correlation_uri=None, correlation_is_anchor=None, correlation_is_last=None)[source]

Bases: object

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

__slots__ = ['match', 'details', 'details_arg', 'get_retained', 'forward_for', 'correlation_id',...
message_attr()[source]

Returns options dict as sent within WAMP messages.

__str__()[source]

Return str(self).

class autobahn.wamp.types.EventDetails(subscription, publication, publisher=None, publisher_authid=None, publisher_authrole=None, topic=None, retained=None, transaction_hash=None, enc_algo=None, forward_for=None)[source]

Bases: object

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

__slots__ = ['subscription', 'publication', 'publisher', 'publisher_authid', 'publisher_authrole', 'topic',...
__str__()[source]

Return str(self).

class autobahn.wamp.types.PublishOptions(acknowledge=None, exclude_me=None, exclude=None, exclude_authid=None, exclude_authrole=None, eligible=None, eligible_authid=None, eligible_authrole=None, retain=None, forward_for=None, transaction_hash=None, correlation_id=None, correlation_uri=None, correlation_is_anchor=None, correlation_is_last=None)[source]

Bases: object

Used to provide options for subscribing in autobahn.wamp.interfaces.IPublisher.publish().

__slots__ = ['acknowledge', 'exclude_me', 'exclude', 'exclude_authid', 'exclude_authrole', 'eligible',...
message_attr()[source]

Returns options dict as sent within WAMP messages.

__str__()[source]

Return str(self).

class autobahn.wamp.types.RegisterOptions(match=None, invoke=None, concurrency=None, force_reregister=None, forward_for=None, details=None, details_arg=None, correlation_id=None, correlation_uri=None, correlation_is_anchor=None, correlation_is_last=None)[source]

Bases: object

Used to provide options for registering in autobahn.wamp.interfaces.ICallee.register().

__slots__ = ['match', 'invoke', 'concurrency', 'force_reregister', 'forward_for', 'details', 'details_arg',...
message_attr()[source]

Returns options dict as sent within WAMP messages.

__str__()[source]

Return str(self).

class autobahn.wamp.types.CallDetails(registration, progress=None, caller=None, caller_authid=None, caller_authrole=None, procedure=None, transaction_hash=None, enc_algo=None, forward_for=None)[source]

Bases: object

Provides details on a call when an endpoint previously registered is being called and opted to receive call details.

__slots__ = ['registration', 'progress', 'caller', 'caller_authid', 'caller_authrole', 'procedure',...
__str__()[source]

Return str(self).

class autobahn.wamp.types.CallOptions(on_progress=None, timeout=None, transaction_hash=None, caller=None, caller_authid=None, caller_authrole=None, forward_for=None, correlation_id=None, correlation_uri=None, correlation_is_anchor=None, correlation_is_last=None, details=None)[source]

Bases: object

Used to provide options for calling with autobahn.wamp.interfaces.ICaller.call().

__slots__ = ['on_progress', 'timeout', 'transaction_hash', 'caller', 'caller_authid', 'caller_authrole',...
message_attr()[source]

Returns options dict as sent within WAMP messages.

__str__()[source]

Return str(self).

class autobahn.wamp.types.CallResult(*results, **kwresults)[source]

Bases: object

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

__slots__ = ['results', 'kwresults', 'enc_algo', 'callee', 'callee_authid', 'callee_authrole', 'forward_for']
__str__()[source]

Return str(self).

class autobahn.wamp.types.EncodedPayload(payload, enc_algo, enc_serializer=None, enc_key=None)[source]

Bases: object

Wrapper holding an encoded application payload when using WAMP payload transparency.

__slots__ = ['payload', 'enc_algo', 'enc_serializer', 'enc_key']
class autobahn.wamp.types.TransportDetails(channel_type: Optional[int] = None, channel_framing: Optional[int] = None, channel_serializer: Optional[int] = None, own: Optional[str] = None, peer: Optional[str] = None, is_server: Optional[bool] = None, own_pid: Optional[int] = None, own_tid: Optional[int] = None, own_fd: Optional[int] = None, is_secure: Optional[bool] = None, channel_id: Optional[Dict[str, bytes]] = None, peer_cert: Optional[Dict[str, Any]] = None, websocket_protocol: Optional[str] = None, websocket_extensions_in_use: Optional[List[str]] = None, http_headers_received: Optional[Dict[str, Any]] = None, http_headers_sent: Optional[Dict[str, Any]] = None, http_cbtid: Optional[str] = None)[source]

Bases: object

Details about a WAMP transport used for carrying a WAMP session. WAMP can be communicated over different bidirectional underlying transport mechanisms, such as TCP, TLS, Serial connections or In-memory queues.

property channel_typeid

Return a short type identifier string for the combination transport type, framing and serializer. Here are some common examples:

  • "tcp-websocket-json"

  • "tls-websocket-msgpack"

  • "memory-rawsocket-cbor"

  • "memory-rawsocket-flatbuffers"

  • "function-native-native"

Returns

property channel_type: Optional[int]

The underlying transport type, e.g. TCP.

property channel_framing: Optional[int]

The message framing used on this transport, e.g. WebSocket.

property channel_serializer: Optional[int]

The message serializer used on this transport, e.g. CBOR (batched or unbatched).

property own: Optional[str]

https://github.com/crossbario/autobahn-python/blob/master/autobahn/websocket/test/test_websocket_url.py https://github.com/crossbario/autobahn-python/blob/master/autobahn/rawsocket/test/test_rawsocket_url.py

A WebSocket server URL:

  • ws://localhost

  • wss://example.com:443/ws

  • ws://62.146.25.34:80/ws

  • wss://localhost:9090/ws?foo=bar

A RawSocket server URL:

  • rs://crossbar:8081

  • rss://example.com

  • rs://unix:/tmp/file.sock

  • rss://unix:../file.sock

property peer: Optional[str]

The peer this transport is connected to.

process:12784 pipe

tcp4:127.0.0.1:38810 tcp4:127.0.0.1:8080 unix:/tmp/file.sock

property is_server: Optional[bool]
Flag indicating whether this side of the peer is a “server” (on underlying transports that

follows a client-server approach).

property own_pid: Optional[int]

The process ID (PID) of this end of the connection.

property own_tid: Optional[int]

The native thread ID of this end of the connection.

See https://docs.python.org/3/library/threading.html#threading.get_native_id.

Note

On CPython 3.7, instead of the native thread ID, a synthetic thread ID that has no direct meaning is used (via threading.get_ident()).

property own_fd: Optional[int]

The file descriptor (FD) at this end of the connection.

property is_secure: Optional[bool]

Flag indicating whether this transport runs over TLS (or similar), and hence is encrypting at the byte stream or datagram transport level (beneath WAMP payload encryption).

property channel_id: Dict[str, bytes]

If this transport runs over a secure underlying connection, e.g. TLS, return a map of channel binding by binding type.

Return the unique channel ID of the underlying transport. This is used to mitigate credential forwarding man-in-the-middle attacks when running application level authentication (eg WAMP-cryptosign) which are decoupled from the underlying transport.

The channel ID is only available when running over TLS (either WAMP-WebSocket or WAMP-RawSocket). It is not available for non-TLS transports (plain TCP or Unix domain sockets). It is also not available for WAMP-over-HTTP/Longpoll. Further, it is currently unimplemented for asyncio (only works on Twisted).

The channel ID is computed as follows:

  • for a client, the SHA256 over the “TLS Finished” message sent by the client to the server is returned.

  • for a server, the SHA256 over the “TLS Finished” message the server expected the client to send

Note: this is similar to tls-unique as described in RFC5929, but instead of returning the raw “TLS Finished” message, it returns a SHA256 over such a message. The reason is that we use the channel ID mainly with WAMP-cryptosign, which is based on Ed25519, where keys are always 32 bytes. And having a channel ID which is always 32 bytes (independent of the TLS ciphers/hashfuns in use) allows use to easily XOR channel IDs with Ed25519 keys and WAMP-cryptosign challenges.

WARNING: For safe use of this (that is, for safely binding app level authentication to the underlying transport), you MUST use TLS, and you SHOULD deactivate both TLS session renegotiation and TLS session resumption.

References:

property peer_cert: Dict[str, Any]

If this transport is using TLS and the TLS peer has provided a valid certificate, this attribute returns the peer certificate.

See here for details about the object returned.

property websocket_protocol: Optional[str]

If the underlying connection uses a regular HTTP based WebSocket opening handshake, the WebSocket subprotocol negotiated, e.g. "wamp.2.cbor.batched".

property websocket_extensions_in_use: Optional[List[str]]

If the underlying connection uses a regular HTTP based WebSocket opening handshake, the WebSocket extensions negotiated, e.g. ["permessage-deflate", "client_no_context_takeover", "client_max_window_bits"].

property http_headers_received: Dict[str, Any]

If the underlying connection uses a regular HTTP based WebSocket opening handshake, the HTTP request headers as received from the client on this connection.

property http_headers_sent: Dict[str, Any]

If the underlying connection uses a regular HTTP based WebSocket opening handshake, the HTTP response headers as sent from the server on this connection.

property http_cbtid: Optional[str]

If the underlying connection uses a regular HTTP based WebSocket opening handshake, the HTTP cookie value of the WAMP tracking cookie if any is associated with this connection.

__slots__ = ['_channel_type', '_channel_framing', '_channel_serializer', '_own', '_peer', '_is_server',...
CHANNEL_TYPE_NONE = 0
CHANNEL_TYPE_FUNCTION = 1
CHANNEL_TYPE_MEMORY = 2
CHANNEL_TYPE_SERIAL = 3
CHANNEL_TYPE_TCP = 4
CHANNEL_TYPE_TLS = 5
CHANNEL_TYPE_UDP = 6
CHANNEL_TYPE_DTLS = 7
CHANNEL_TYPE_TO_STR
CHANNEL_TYPE_FROM_STR
CHANNEL_FRAMING_NONE = 0
CHANNEL_FRAMING_NATIVE = 1
CHANNEL_FRAMING_WEBSOCKET = 2
CHANNEL_FRAMING_RAWSOCKET = 3
CHANNEL_FRAMING_TO_STR
CHANNEL_FRAMING_FROM_STR
CHANNEL_SERIALIZER_NONE = 0
CHANNEL_SERIALIZER_JSON = 1
CHANNEL_SERIALIZER_MSGPACK = 2
CHANNEL_SERIALIZER_CBOR = 3
CHANNEL_SERIALIZER_UBJSON = 4
CHANNEL_SERIALIZER_FLATBUFFERS = 5
CHANNEL_SERIALIZER_TO_STR
CHANNEL_SERIALIZER_FROM_STR
__eq__(other)[source]

Return self==value.

__ne__(other)[source]

Return self!=value.

static parse(data: Dict[str, Any]) TransportDetails[source]
marshal() Dict[str, Any][source]
__str__() str[source]

Return str(self).

class autobahn.wamp.types.SessionDetails(realm: Optional[str] = None, session: Optional[int] = None, authid: Optional[str] = None, authrole: Optional[str] = None, authmethod: Optional[str] = None, authprovider: Optional[str] = None, authextra: Optional[Dict[str, Any]] = None, serializer: Optional[str] = None, transport: Optional[TransportDetails] = None, resumed: Optional[bool] = None, resumable: Optional[bool] = None, resume_token: Optional[str] = None)[source]

Bases: object

Provides details for a WAMP session upon open.

property realm: Optional[str]

The WAMP realm this session is attached to, e.g. "realm1".

property session: Optional[int]

WAMP session ID of this session, e.g. 7069739155960584.

property authid: Optional[str]

The WAMP authid this session is joined as, e.g. "joe89"

property authrole: Optional[str]

The WAMP authrole this session is joined as, e.g. "user".

property authmethod: Optional[str]

The WAMP authentication method the session is authenticated under, e.g. "anonymous" or "wampcra".

property authprovider: Optional[str]

The WAMP authentication provider that handled the session authentication, e.g. "static" or "dynamic".

property authextra: Optional[Dict[str, Any]]

The (optional) WAMP authentication extra that was provided to the authenticating session.

property serializer: Optional[str]

The WAMP serializer (variant) this session is using, e.g. "json" or "cbor.batched".

property transport: Optional[TransportDetails]

The details of the WAMP transport this session is hosted on (communicates over).

property resumed: Optional[bool]

Whether the session is a resumed one.

property resumable: Optional[bool]

Whether this session can be resumed later.

property resume_token: Optional[str]

The secure authorization token to resume the session.

__slots__ = ['_realm', '_session', '_authid', '_authrole', '_authmethod', '_authprovider', '_authextra',...
__eq__(other)[source]
Parameters

other

Returns

__ne__(other)[source]
Parameters

other

Returns

static parse(data: Dict[str, Any]) SessionDetails[source]
Parameters

data

Returns

marshal() Dict[str, Any][source]
Returns

__str__() str[source]

Return str(self).