Как реорганизовать этот код с помощью потоков akka.
Идея состоит в том, чтобы сохранить канал открытым, чтобы использовать его позже. В playframework 2.5.x документация говорит, что вы должны использовать потоки akka, но ничего не говорит о том, как добиться этого примера. Кто-нибудь может мне помочь?
import play.api.mvc._
import play.api.libs.iteratee._
import play.api.libs.concurrent.Execution.Implicits.defaultContext
def socket = WebSocket.using[String] { request =>
// Concurrent.broadcast returns (Enumerator, Concurrent.Channel)
val (out, channel) = Concurrent.broadcast[String]
// log the message to stdout and send response back to client
val in = Iteratee.foreach[String] {
msg => println(msg)
// the Enumerator returned by Concurrent.broadcast subscribes to the channel and will
// receive the pushed messages
channel push("I received your message: " + msg)
}
(in,out)
}