How would you do outgoing messages in this example...
# coroutines
j
How would you do outgoing messages in this example
Copy code
class Network(val agent: SendChannel<AgentMessage>) : AsyncRunnable {
    val context = ZMQ.context(1)
    val pull = context.socket(ZMQ.PULL)
    val zmqWaitThread = newSingleThreadContext("zmqWaitThread")

    override suspend fun run() {
        pull.bind("<tcp://127.0.0.1:6000>")
        while (true) {
            val message = withContext(zmqWaitThread) {
                pull.recvStr()
            }

            agent.send(AgentMessage.Payload(message))
        }
    }
}