has anyone else had trouble with using a channel i...
# multiplatform
w
has anyone else had trouble with using a channel in a multiplatform context? right now i'm testing on android but for some reason my iterator over my channel is not receiving any values. when i attempt to reduce the problem and run it in a jvm only project it works fine though
Copy code
class PersistentWsClient() {
	private val scope = CoroutineScope(Dispatchers.Default)
    private val sendingQueue = Channel<Frame>(UNLIMITED)

    fun open(host: String, path: String, port: Int = 8080) {
        scope.launch {
            this@PersistentWsClient.e("waiting for messages")
            for (msg in sendingQueue) {
                this@PersistentWsClient.e(msg.toString())
            }
        }
    }

    fun send(payload: Frame) {
        scope.launch {
            for (i in 0..10) {
                delay(500)
                sendingQueue.offer(payload)
                this.e("offering $payload")
            }
        }
        sendingQueue.offer(payload)
    }
}
(i have stripped away some extra code). In this example i only ever get
Copy code
waiting for messages
offering <payload>
offering <payload>
...
i posted in #coroutines as well but haven't had any help there yet