Skip to main content

__aiter__()

Yield received values until CLOSED or PEER_GONE.

Usage

Source

__aiter__()

Each value is awaited through recv_async(). No waiter stays armed between iterations. The next iteration drains any values that arrived in the meantime.

A ForeignPayloadError ends the async for statement. A try/except inside the loop body cannot catch it. To skip the payload, wrap the whole loop and re-enter on the same channel. The channel remains usable, and the new iterator receives the next message.