Created
July 3, 2016 14:40
-
-
Save odenzo/3d66b54b1af65598327813b52f160877 to your computer and use it in GitHub Desktop.
akka-http flow handling of non-strict and strict inbound websocket messages
This file contains 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
trait InboundTransforms extends StrictLogging { | |
protected def message2text(msg: Message): Future[String] = { | |
msg match { | |
case message: TextMessage.Strict ⇒ Future.successful(message.text) | |
case message: TextMessage.Streamed ⇒ message.textStream.runFold("")(_ + _) | |
case default ⇒ Future.successful("Default: " + default) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment