Last active
December 10, 2015 01:38
-
-
Save atamborrino/4360663 to your computer and use it in GitHub Desktop.
Play 2.1 - Using Concurrent.PatchPannel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def stream = WebSocket.using[JsValue] { req => | |
val out = Concurrent.patchPanel[JsValue] { patcher => | |
// callback called when the enumerator "out" is applied to an iteratee, here the | |
// Websocket output Iteratee | |
patcher.patchIn(streamEnumerator1) | |
// ... | |
patcher.patchIn(streamEnumerator2) | |
} | |
val in = Iteratee.foreach[JsValue] { json => | |
val topic = // read json and get the topic that the user want to subscribe to | |
} mapDone { _ => println("Disconnected") } | |
(in, out) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment