autobahn.wamp.types

Classes

Accept

Information to accept a HELLO.

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

Challenge

Information to challenge the client upon HELLO.

CloseDetails

Provides details for a WAMP session upon close.

ComponentConfig

WAMP application component configuration. An instance of this class is

Deny

Information to deny a HELLO.

EncodedPayload

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

EventDetails

Provides details on an event when calling an event handler

HelloDetails

Provides details of a WAMP session while still attaching.

HelloReturn

Base class for HELLO return information.

Publication

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

PublishOptions

Used to provide options for subscribing in

RegisterOptions

Used to provide options for registering in

Registration

Object representing a registration.

SessionDetails

Provides details for a WAMP session upon open.

SessionIdent

WAMP session identification information.

SubscribeOptions

Used to provide options for subscribing in

Subscription

Object representing a handler subscription.

TransportDetails

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

Module Contents

class Accept(realm: str | None = None, authid: str | None = None, authrole: str | None = None, authmethod: str | None = None, authprovider: str | None = None, authextra: Dict[str, Any] | None = None)[source]

Bases: HelloReturn

Information to accept a HELLO.

__slots__ = ('realm', 'authid', 'authrole', 'authmethod', 'authprovider', 'authextra')[source]
__str__()[source]
authextra = None[source]
authid = None[source]
authmethod = None[source]
authprovider = None[source]
authrole = None[source]
realm = None[source]
class 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',...[source]
__str__()[source]
caller = None[source]
caller_authid = None[source]
caller_authrole = None[source]
enc_algo = None[source]
forward_for = None[source]
procedure = None[source]
progress = None[source]
registration[source]
transaction_hash = None[source]
class 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',...[source]
__str__()[source]
caller = None[source]
caller_authid = None[source]
caller_authrole = None[source]
correlation_id = None[source]
correlation_is_anchor = None[source]
correlation_is_last = None[source]
correlation_uri = None[source]
details = None[source]
forward_for = None[source]
message_attr()[source]

Returns options dict as sent within WAMP messages.

on_progress = None[source]
timeout = None[source]
transaction_hash = None[source]
class 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')[source]
__str__()[source]
callee[source]
callee_authid[source]
callee_authrole[source]
enc_algo[source]
forward_for[source]
kwresults[source]
results = ()[source]
class Challenge(method, extra=None)[source]

Bases: HelloReturn

Information to challenge the client upon HELLO.

__slots__ = ('method', 'extra')[source]
__str__()[source]
extra[source]
method[source]
class CloseDetails(reason=None, message=None)[source]

Bases: object

Provides details for a WAMP session upon close.

REASON_DEFAULT = 'wamp.close.normal'[source]
REASON_TRANSPORT_LOST = 'wamp.close.transport_lost'[source]
__slots__ = ('reason', 'message')[source]
__str__()[source]
marshal()[source]
message = None[source]
reason = None[source]
class 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')[source]
__str__()[source]
controller = None[source]
extra = None[source]
keyring = None[source]
realm = None[source]
runner = None[source]
shared = None[source]
class Deny(reason='wamp.error.not_authorized', message=None)[source]

Bases: HelloReturn

Information to deny a HELLO.

__slots__ = ('reason', 'message')[source]
__str__()[source]
message = None[source]
reason = 'wamp.error.not_authorized'[source]
class 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')[source]
enc_algo[source]
enc_key = None[source]
enc_serializer = None[source]
payload[source]
class 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',...[source]
__str__()[source]
enc_algo = None[source]
forward_for = None[source]
publication[source]
publisher = None[source]
publisher_authid = None[source]
publisher_authrole = None[source]
retained = None[source]
subscription[source]
topic = None[source]
transaction_hash = None[source]
class 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',...[source]
__str__()[source]
authextra = None[source]
authid = None[source]
authmethods = None[source]
authrole = None[source]
pending_session = None[source]
realm = None[source]
resumable = None[source]
resume_session = None[source]
resume_token = None[source]
session_roles = None[source]
class HelloReturn[source]

Bases: object

Base class for HELLO return information.

class Publication(publication_id, was_encrypted)[source]

Bases: object

Object representing a publication (feedback from publishing an event when doing an acknowledged publish).

__slots__ = ('id', 'was_encrypted')
__str__()[source]
id
was_encrypted
class 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',...[source]
__str__()[source]
acknowledge = None[source]
correlation_id = None[source]
correlation_is_anchor = None[source]
correlation_is_last = None[source]
correlation_uri = None[source]
eligible = None[source]
eligible_authid = None[source]
eligible_authrole = None[source]
exclude = None[source]
exclude_authid = None[source]
exclude_authrole = None[source]
exclude_me = None[source]
forward_for = None[source]
message_attr()[source]

Returns options dict as sent within WAMP messages.

retain = None[source]
transaction_hash = None[source]
class 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',...[source]
__str__()[source]
concurrency = None[source]
correlation_id = None[source]
correlation_is_anchor = None[source]
correlation_is_last = None[source]
correlation_uri = None[source]
details = None[source]
force_reregister = None[source]
forward_for = None[source]
invoke = None[source]
match = None[source]
message_attr()[source]

Returns options dict as sent within WAMP messages.

class Registration(session, registration_id, procedure, endpoint)[source]

Bases: object

Object representing a registration.

__slots__ = ('id', 'active', 'session', 'procedure', 'endpoint')
__str__()[source]
active = True
endpoint
id
procedure
session
unregister()[source]
class SessionDetails(realm: str | None = None, session: int | None = None, authid: str | None = None, authrole: str | None = None, authmethod: str | None = None, authprovider: str | None = None, authextra: Dict[str, Any] | None = None, serializer: str | None = None, transport: TransportDetails | None = None, resumed: bool | None = None, resumable: bool | None = None, resume_token: str | None = None)[source]

Bases: object

Provides details for a WAMP session upon open.

__eq__(other)[source]
Parameters:

other

Returns:

__ne__(other)[source]
Parameters:

other

Returns:

__slots__ = ('_realm', '_session', '_authid', '_authrole', '_authmethod', '_authprovider', '_authextra',...[source]
__str__() str[source]
_authextra = None[source]
_authid = None[source]
_authmethod = None[source]
_authprovider = None[source]
_authrole = None[source]
_realm = None[source]
_resumable = None[source]
_resume_token = None[source]
_resumed = None[source]
_serializer = None[source]
_session = None[source]
_transport = None[source]
property authextra: Dict[str, Any] | None[source]

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

property authid: str | None[source]

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

property authmethod: str | None[source]

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

property authprovider: str | None[source]

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

property authrole: str | None[source]

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

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

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

data

Returns:

property realm: str | None[source]

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

property resumable: bool | None[source]

Whether this session can be resumed later.

property resume_token: str | None[source]

The secure authorization token to resume the session.

property resumed: bool | None[source]

Whether the session is a resumed one.

property serializer: str | None[source]

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

property session: int | None[source]

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

property transport: TransportDetails | None[source]

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

class 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')[source]
__str__()[source]
authid = None[source]
authrole = None[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

marshal()[source]
session = None[source]
class 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',...[source]
__str__()[source]
correlation_id = None[source]
correlation_is_anchor = None[source]
correlation_is_last = None[source]
correlation_uri = None[source]
details = None[source]
forward_for = None[source]
get_retained = None[source]
match = None[source]
message_attr()[source]

Returns options dict as sent within WAMP messages.

class Subscription(subscription_id, topic, session, handler)[source]

Bases: object

Object representing a handler subscription.

__slots__ = ('id', 'topic', 'active', 'session', 'handler')
__str__()[source]
active = True
handler
id
session
topic
unsubscribe()[source]

Unsubscribe this subscription.

class TransportDetails(channel_type: int | None = None, channel_framing: int | None = None, channel_serializer: int | None = None, own: str | None = None, peer: str | None = None, is_server: bool | None = None, own_pid: int | None = None, own_tid: int | None = None, own_fd: int | None = None, is_secure: bool | None = None, channel_id: Dict[str, bytes] | None = None, peer_cert: Dict[str, Any] | None = None, websocket_protocol: str | None = None, websocket_extensions_in_use: List[str] | None = None, http_headers_received: Dict[str, Any] | None = None, http_headers_sent: Dict[str, Any] | None = None, http_cbtid: str | None = 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.

CHANNEL_FRAMING_FROM_STR[source]
CHANNEL_FRAMING_NATIVE = 1[source]
CHANNEL_FRAMING_NONE = 0[source]
CHANNEL_FRAMING_RAWSOCKET = 3[source]
CHANNEL_FRAMING_TO_STR[source]
CHANNEL_FRAMING_WEBSOCKET = 2[source]
CHANNEL_SERIALIZER_CBOR = 3[source]
CHANNEL_SERIALIZER_FLATBUFFERS = 5[source]
CHANNEL_SERIALIZER_FROM_STR[source]
CHANNEL_SERIALIZER_JSON = 1[source]
CHANNEL_SERIALIZER_MSGPACK = 2[source]
CHANNEL_SERIALIZER_NONE = 0[source]
CHANNEL_SERIALIZER_TO_STR[source]
CHANNEL_SERIALIZER_UBJSON = 4[source]
CHANNEL_TYPE_DTLS = 7[source]
CHANNEL_TYPE_FROM_STR[source]
CHANNEL_TYPE_FUNCTION = 1[source]
CHANNEL_TYPE_MEMORY = 2[source]
CHANNEL_TYPE_NONE = 0[source]
CHANNEL_TYPE_SERIAL = 3[source]
CHANNEL_TYPE_TCP = 4[source]
CHANNEL_TYPE_TLS = 5[source]
CHANNEL_TYPE_TO_STR[source]
CHANNEL_TYPE_UDP = 6[source]
__eq__(other)[source]
__ne__(other)[source]
__slots__ = ('_channel_type', '_channel_framing', '_channel_serializer', '_own', '_peer', '_is_server',...[source]
__str__() str[source]
_channel_framing = None[source]
_channel_id = None[source]
_channel_serializer = None[source]
_channel_type = None[source]
_http_cbtid = None[source]
_http_headers_received = None[source]
_http_headers_sent = None[source]
_is_secure = None[source]
_is_server = None[source]
_own = None[source]
_own_fd = None[source]
_own_pid = None[source]
_own_tid = None[source]
_peer = None[source]
_peer_cert = None[source]
_websocket_extensions_in_use = None[source]
_websocket_protocol = None[source]
property channel_framing: int | None[source]

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

property channel_id: Dict[str, bytes][source]

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 channel_serializer: int | None[source]

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

property channel_type: int | None[source]

The underlying transport type, e.g. TCP.

property channel_typeid[source]

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 http_cbtid: str | None[source]

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.

property http_headers_received: Dict[str, Any][source]

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][source]

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 is_secure: bool | None[source]

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 is_server: bool | None[source]

Flag indicating whether this side of the peer is a “server” (on underlying transports that follows a client-server approach).

marshal() Dict[str, Any][source]
property own: str | None[source]

//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

Type:

https

property own_fd: int | None[source]

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

property own_pid: int | None[source]

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

property own_tid: int | None[source]

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

static parse(data: Dict[str, Any]) TransportDetails[source]
property peer: str | None[source]

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 peer_cert: Dict[str, Any][source]

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_extensions_in_use: List[str] | None[source]

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 websocket_protocol: str | None[source]

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