aiowamp.Client

class aiowamp.Client(session)[source]

Initialise the client.

A client is just a wrapper for a session. It takes full control over the session, so when the client closes so will the session.

Parameters:session (SessionABC) – Session to wrap.
__init__(session)[source]

Initialise the client.

A client is just a wrapper for a session. It takes full control over the session, so when the client closes so will the session.

Parameters:session (SessionABC) – Session to wrap.
Return type:None

Methods

__init__(session) Initialise the client.
call(procedure, *args[, kwargs, …]) Call a remote procedure.
close([details, reason]) Close the client and the underlying session.
get_registration_ids(procedure) Get the ids of the registrations for the given procedure.
get_subscription_ids(topic) Get the ids of the subscriptions for the given topic.
publish(topic, *args[, kwargs, acknowledge, …]) Publish an event to a topic.
register(procedure, handler, *[, …]) Register a procedure.
subscribe(topic, callback, *[, …]) Subscribe to a topic.
unregister(procedure[, registration_id]) Unregister a procedure.
unsubscribe(topic[, subscription_id]) Unsubscribe from the given topic.
wait_until_done() Wait until the client is done.

Attributes

id_gen ID generator used to generate the client ids.
session Session the client is attached to.
__init__(session)[source]

Initialise the client.

A client is just a wrapper for a session. It takes full control over the session, so when the client closes so will the session.

Parameters:session (SessionABC) – Session to wrap.
Return type:None
session

Session the client is attached to.

id_gen

ID generator used to generate the client ids.

__repr__()[source]

Return repr(self).

Return type:str
__str__()[source]

Return str(self).

Return type:str
close(details=None, *, reason=None)[source]

Close the client and the underlying session.

Parameters:
  • details (Optional[Dict[str, ForwardRef]]) – Additional details to send with the close message.
  • reason (Optional[str]) – URI denoting the reason for closing. Defaults to aiowamp.uri.CLOSE_NORMAL.
Return type:

None

publish(topic, *args, kwargs=None, acknowledge=None, blackwhitelist=None, exclude_me=None, disclose_me=None, resource_key=None, options=None)[source]

Publish an event to a topic.

Parameters:
Return type:

None

register(procedure, handler, *, disclose_caller=None, match_policy=None, invocation_policy=None, options=None)[source]

Register a procedure.

Parameters:
Return type:

int

Returns:

The registration id of the registered procedure. Can be used to unregister the procedure.

subscribe(topic, callback, *, match_policy=None, node_key=None, options=None)[source]

Subscribe to a topic.

Parameters:
Return type:

int

unregister(procedure, registration_id=None)[source]

Unregister a procedure.

Parameters:
  • procedure (str) – Procedure uri to unregister.
  • registration_id (Optional[int]) – Specific registration id to unregister. If not specified, ALL registrations for the procedure will be unregistered.
Raises:

KeyError – If no registration for the procedure exists.

Return type:

None

unsubscribe(topic, subscription_id=None)[source]

Unsubscribe from the given topic.

Parameters:
  • topic (str) – Topic URI to unsubscribe from.
  • subscription_id (Optional[int]) – Specific subscription id to unsubscribe. If None, unsubscribe all subscriptions to the topic.
Raises:

KeyError – If not subscribed to the topic.

Return type:

None

wait_until_done()[source]

Wait until the client is done.

Return type:None
get_registration_ids(procedure)[source]

Get the ids of the registrations for the given procedure.

Parameters:procedure (str) – Procedure to get registration ids for.
Return type:Tuple[int, …]
Returns:Tuple containing the registration ids.
call(procedure, *args, kwargs=None, receive_progress=None, call_timeout=None, cancel_mode=None, disclose_me=None, resource_key=None, options=None)[source]

Call a remote procedure.

Parameters:
Return type:

CallABC

Returns:

The call instance to interact with the call.

get_subscription_ids(topic)[source]

Get the ids of the subscriptions for the given topic.

Parameters:topic (str) – Topic to get subscription ids for.
Return type:Tuple[int, …]
Returns:Tuple of subscription ids.