In my program on Play 2.0.4 I had this piece of code:
val channel = Enumerator.imperative[JsValue](onStart = self ! NotifyJoin(username))
and now it says that imperative
is deprecated, and the API says that I should use unicast
or broadcast
instead. I tend to use unicast
since in my code the channel
was unicast. So I make like
val channel = Concurrent.unicast[JsValue](onStart = self ! NotifyJoin(username))
But it does not work.. looks like that unicast
wants something else. I cannot figure it out - there is no more info in the API... does anyone know what to do here?
UPDATE:
Started a discussion in Play Framework user group. Turns out to be a pretty common problem among developers, who are knew to the paradigm. Will hope the documentation is going to be improved.
The API for Concurrent.unicast
is:
unicast[E](onStart: (Channel[E]) ⇒ Unit, onComplete: ⇒ Unit, onError: (String, Input[E]) ⇒ Unit): Enumerator[E]
The API for Concurrent.broadcast
is:
broadcast[E]: (Enumerator[E], Channel[E])
You can get to the API in your app at:
http://localhost:9000/@documentation/api/scala/index.html#play.api.libs.iteratee.Concurrent$
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With