Method DrainAsync
DrainAsync(CancellationToken)
Drain the subscription: stop receiving new messages while letting messages already buffered be read, keeping the connection usable.
ValueTask DrainAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenBounds the best-effort PING/PONG fence wait, which lasts at most DrainPingTimeout; the token can only shorten it, not extend it past that timeout.
Returns
Remarks
Sends an unsubscribe to the server, waits for a PING/PONG round-trip so messages already in flight are delivered, then completes Msgs. Keep reading Msgs until it completes to process the buffered messages. Unlike UnsubscribeAsync(), drain does not drop messages still in the socket buffer. The connection stays open.