Como refatorar esse código usando fluxos akka.
A idéia é manter o canal aberto para usá-lo mais tarde. No playframework 2.5.x, a documentação diz que você precisa usar fluxos akka, mas não diz nada sobre como obter esse exemplo. Alguém pode me ajudar?
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)
}