There should be something like `connection.onidle` but for when a stream's `state` changes (or maybe only closes). What's the best workaround for that?