I am trying the application in - 30 minutes to make realtime paint - youtube video. I have tried to follow it as closely as possible and after all that just as when I thought it was completed, I get deprecation warnings!
I am trying to learn scala & play. Tried Googling a bit with no help; I just do not know where to start looking in order solve the problem.
The relevant code snippet comes around Minute:26 in the video. A copy here as well:
val hubEnum = Enumerator.imperative[JsValue]()
val hub = Concurrent.hub[JsValue](hubEnum)
var counter = 0
def index = Action {
Ok(views.html.index("Your new application is ready."))
}
def stream = WebSocket.async[JsValue] { request =>
var out = hub.getPatchCord()
counter += 1
var pid = counter
var in = Iteratee.foreach[JsValue](_ match {
case message: JsObject => {
hubEnum push(message ++ JsObject(Seq("pid" -> JsNumber(pid))))
}
})
Promise.pure((in, out))
}
The error:
[warn] /home/user/devpt/testpaint/app/controllers/Application.scala:12: class PushEnumerator in package iteratee is deprecated: use Concurrent.broadcast instead
[warn] val hubEnum = Enumerator.imperative[JsValue]()
[warn] ^
[warn] /home/user/devpt/testpaint/app/controllers/Application.scala:12: method imperative in object Enumerator is deprecated: use Concurrent.broadcast instead
[warn] val hubEnum = Enumerator.imperative[JsValue]()
[warn] ^
[warn] /home/user/devpt/testpaint/app/controllers/Application.scala:13: trait Hub in object Concurrent is deprecated: use Concurrent.broadcast instead
[warn] val hub = Concurrent.hub[JsValue](hubEnum)
[warn] ^
[warn] /home/user/devpt/testpaint/app/controllers/Application.scala:13: method hub in object Concurrent is deprecated: use Concurrent.broadcast instead
[warn] val hub = Concurrent.hub[JsValue](hubEnum)
[warn] ^