wait
Waits for the connection to go idle (nothing received for a short while).
Waiting is best-effort: a page can stream events indefinitely — polling, server-sent events, ads, a refreshing interstitial — in which case idleness never arrives. That is not an error, so after idleTimeout this simply stops watching and returns rather than waiting forever.
Parameters
t
Minimum time in milliseconds to wait, even if the connection settles sooner. This is a floor, not a deadline: it never cuts the wait short. Null means no minimum.
idleTimeout
Upper bound in milliseconds on watching for idleness. It caps the watching only — a larger t is still honoured.