Reputation: 478
I would like to feed a WebSocket output Iteratee with several enumerators progressively (for example I want to add a specific enumerator to the output Iteratee when I receive a specific event through the Websocket input iteratee).
If I am right this is impossible if I just return (in,out)
at the end of the Websocket function argument as out is already an immutable enumerator:
WebSocket.using[JsValue] { request =>
val in: Iteratee[JsValue,Unit] = ...
val out: Enumerator[JsValue] = ...
(in, out)
}
I think that Concurrent.PatchPannel is what I am looking for, but I can't manage to understand how to use it. Does anyone have an example of using Concurrent.PatchPannel? (if this is indeed what I am looking for).
Thanks
Upvotes: 2
Views: 1413
Reputation: 478
I have finally found the solution myself.
Edit: See the "Mixable sub-streams" section in my blog post: http://atamborrino.github.io/play/2013/12/25/play-framework-websocket.html
Upvotes: 5