Skip to content

Instantly share code, notes, and snippets.

@odenzo
Created July 3, 2016 14:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odenzo/3d66b54b1af65598327813b52f160877 to your computer and use it in GitHub Desktop.
Save odenzo/3d66b54b1af65598327813b52f160877 to your computer and use it in GitHub Desktop.
akka-http flow handling of non-strict and strict inbound websocket messages
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