SHARE
TWEET

Untitled

a guest Jun 15th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private val (chatSink, chatSource) = {
  2.     val source = MergeHub.source[WSMessage]
  3.       .log("source")
  4.       .map { msg =>
  5.       try {
  6.         val json = Json.parse(msg)
  7.         inputSanitizer.sanText((json  "msg").as[String])
  8.       } catch {
  9.         case e: Exception => println(">>" + msg)
  10.           "Malfunction client"
  11.       }
  12.     }
  13.      .recoverWithRetries(-1, { case _: Exception ⇒ Source.empty })
  14.  
  15.     val sink = BroadcastHub.sink[WSMessage]
  16.     source.toMat(sink)(Keep.both).run()
  17.   }
  18.  
  19.   private val userFlow: Flow[WSMessage, WSMessage, _] = {
  20.     Flow.fromSinkAndSource(chatSink, chatSource)
  21.   }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top