aiowamp.ClientABC¶
-
class
aiowamp.
ClientABC
[source]¶ WAMP Client.
Implements the publisher, subscriber, caller, and callee roles.
-
__init__
()¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
Initialize self. call
(procedure, *args[, kwargs, …])Call a remote procedure. close
([details, reason])Close the client and the underlying session. 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. -
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: - procedure (
str
) – Procedure uri to call. - *args – Arguments to pass to the call.
- kwargs (
Optional
[Dict
[str
,ForwardRef
]]) – Keyword arguments to pass to the call. - receive_progress (
Optional
[bool
]) – Whether the callee may send progress results. - call_timeout (
Optional
[float
]) – Timeout in seconds for the call. - cancel_mode (
Optional
[NewType()
(CancelMode
,str
)]) – Cancel mode to use when cancelling the call. Seeaiowamp.Call.cancel
. - disclose_me (
Optional
[bool
]) – Whether to disclose the client to the callee. - resource_key (
Optional
[str
]) – Resource key for sharded registrations. - options (
Optional
[Dict
[str
,ForwardRef
]]) – Additional options to pass. - args (
Union
[int
,str
,bool
,ForwardRef
,ForwardRef
]) –
Return type: CallABC
Returns: The call instance to interact with the call.
- procedure (
-
close
(details=None, *, reason=None)[source]¶ Close the client and the underlying session.
Parameters: 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: - topic (
str
) – Topic uri to publish to. - *args – Arguments for the event.
- kwargs (
Optional
[Dict
[str
,ForwardRef
]]) – Keyword arguments for the event. - acknowledge (
Optional
[bool
]) – Whether to wait for the router to acknowledge the event. - blackwhitelist (
Optional
[BlackWhiteList
]) – Black- and whitelisting subscribers. - exclude_me (
Optional
[bool
]) – Whether the client should receive this event. - disclose_me (
Optional
[bool
]) – Whether the client’s identity should be disclosed to subscribers. - resource_key (
Optional
[str
]) – Resource key for sharded subscriptions. - options (
Optional
[Dict
[str
,ForwardRef
]]) – Additional options. - args (
Union
[int
,str
,bool
,ForwardRef
,ForwardRef
]) –
Return type: None
- topic (
-
register
(procedure, handler, *, disclose_caller=None, match_policy=None, invocation_policy=None, options=None)[source]¶ Register a procedure.
Parameters: - procedure (
str
) – Procedure URI to register. - handler (
Callable
[[ForwardRef
],Union
[Awaitable
[ForwardRef
],AsyncGenerator
[ForwardRef
,None
]]]) – Procedure to call. - disclose_caller (
Optional
[bool
]) – Whether callers’ identities should be disclosed. - match_policy (
Optional
[NewType()
(MatchPolicy
,str
)]) – Match policy for the procedure uri. Can also be specified by passing anaiowamp.URI
with a match policy to the procedure. - invocation_policy (
Optional
[NewType()
(InvocationPolicy
,str
)]) – Invocation policy. - options (
Optional
[Dict
[str
,ForwardRef
]]) – Additional options to pass.
Return type: Returns: The registration id of the registered procedure. Can be used to unregister the procedure.
- procedure (
-
subscribe
(topic, callback, *, match_policy=None, node_key=None, options=None)[source]¶ Subscribe to a topic.
Parameters: - topic (
str
) – Topic uri to subscribe to. - callback (
Callable
[[ForwardRef
],Union
[Any
,Awaitable
[Any
]]]) – Callable to call for each event. - match_policy (
Optional
[NewType()
(MatchPolicy
,str
)]) – Match policy for the uri. Can also be specified by passing anaiowamp.URI
with a match policy. - node_key (
Optional
[str
]) – Node key for sharded subscriptions. - options (
Optional
[Dict
[str
,ForwardRef
]]) – Additional options to pass.
Return type: - topic (
-
unregister
(procedure, registration_id=None)[source]¶ Unregister a procedure.
Parameters: Raises: KeyError
– If no registration for the procedure exists.Return type: None
-