subscribe
Open a long-lived asynchronous subscription for server-pushed events.
Create an async context manager for pushed Herdr events.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
subscriptions
|
Iterable[EventSubscription]
|
Event filters to register with the server. |
required |
Returns:
| Type | Description |
|---|---|
AsyncSubscription
|
An async subscription context manager. Enter it before iterating over |
AsyncSubscription
|
|
The subscriptions iterable contains event filters, for example
{"event": "pane.output"}.
Example
async with client.subscribe([{"event": "pane.output"}]) as stream:
async for event in stream.events():
print(event)
Source code in src/herdr_client/async_client/client.py
578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | |