Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private val (chatSink, chatSource) = {
- val source = MergeHub.source[WSMessage]
- .log("source")
- .map { msg =>
- try {
- val json = Json.parse(msg)
- inputSanitizer.sanText((json "msg").as[String])
- } catch {
- case e: Exception => println(">>" + msg)
- "Malfunction client"
- }
- }
- .recoverWithRetries(-1, { case _: Exception ⇒ Source.empty })
- val sink = BroadcastHub.sink[WSMessage]
- source.toMat(sink)(Keep.both).run()
- }
- private val userFlow: Flow[WSMessage, WSMessage, _] = {
- Flow.fromSinkAndSource(chatSink, chatSource)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement