# Channels of Channels

**URL:** <https://discuss.kotlinlang.org/t/channels-of-channels/3318>\
**Category:** Support\
**Created:** [June 14, 2017, 7:55pm UTC](https://discuss.kotlinlang.org/t/channels-of-channels/3318 "2017-06-14T19:55:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nanodeath](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/nanodeath/32/1803_2.png) [@nanodeath](https://discuss.kotlinlang.org/u/nanodeath)\
**Post date:** [June 14, 2017, 7:55pm UTC](https://discuss.kotlinlang.org/t/channels-of-channels/3318/1 "2017-06-14T19:55:12Z")

</div>

With coroutines, you’re able to use `select` to wait on a number of channels simultaneously. Is it possible to update the list of channels being waited on _after_ the initial execution of the `select` block? Basically, I’d like to be able to pass a channel through another channel, and then select on that.

Something roughly like this:

```kotlin
select<Unit> {
    channel.onReceive { obj ->
        obj.onReceive { inner ->
            // do stuff
        }
    }
}

```

However, this doesn’t really seem to work – even when something is sent to the “inner” channel, it doesn’t ever get consumed. Is there any way to make this work?

---

<div class="post-metadata">

**Author:** ![elizarov](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/elizarov/32/2164_2.png) [@elizarov](https://discuss.kotlinlang.org/u/elizarov)\
**Post date:** [June 14, 2017, 8:06pm UTC](https://discuss.kotlinlang.org/t/channels-of-channels/3318/2 "2017-06-14T20:06:30Z")

</div>

You’ll have to wake up your original `select` and then restart with a new list of clauses. Adding a new clause to a waiting select expression is not currently supported via its public API, even though its internal implementation architecture kind of supports it (you can register at any time). You are welcome to file a feature request to [kotlinx.coroutines](https://github.com/Kotlin/kotlinx.coroutines) project (don’t forget to add some more motivation) and/or contribution the corresponding implementation via pull request.

---

<div class="post-metadata">

**Author:** ![nanodeath](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/nanodeath/32/1803_2.png) [@nanodeath](https://discuss.kotlinlang.org/u/nanodeath)\
**Post date:** [June 14, 2017, 8:24pm UTC](https://discuss.kotlinlang.org/t/channels-of-channels/3318/3 "2017-06-14T20:24:44Z")

</div>

Sounds good. Thanks Roman.
