0
votes

I am trying to migrate my application from play 2.4 to 2.5 While migrating I am trying to remove the deprecated functions. One such warning that I am receiving is "method using in object WebSocket is deprecated: Use accept with an Akka streams flow instead"

Below is the function that I need to change, How do I refactor this code to use Akka Stream Flows.

def test =  WebSocket.using[String] { request =>
   val in = Iteratee.ignore[String]
   val out = Enumerator("<response>Test</response>").andThen(Enumerator.eof)
   Logger.warn("Some warning")
   (in, out)
}

I tried going through How to refactor this code by using akka streams. but could not get much. I am new to scala and play :(

Any pointers or examples would be of great help.

Cheers!

1

1 Answers

1
votes

You can refer to the Play documentation to implement Akka Streams flow. That's quite straightforward.