AsyncSubscription
Asynchronous context manager for a long-lived Herdr event stream. It is normally
created with AsyncHerdrClient.subscribe.
Constructor
Prepare an asynchronous subscription without opening the socket.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
socket_path
|
Path
|
Unix socket path used for the subscription connection. |
required |
timeout
|
float
|
Timeout in seconds for connect, write and read operations. |
required |
subscriptions
|
Iterable[EventSubscription]
|
Event filters sent to |
required |
Example
subscription = AsyncSubscription(
Path("/tmp/herdr.sock"),
timeout=5.0,
subscriptions=[{"event": "pane.output"}],
)
Source code in src/herdr_client/async_client/client.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | |
Method shortlinks
| Member | Purpose |
|---|---|
ack |
Read the server acknowledgement |
__aenter__ |
Open the async context |
__aexit__ |
Close the async context |
aclose |
Close the connection explicitly |
events |
Iterate asynchronously over events |