I am migrating from Play to Akka HTTP. I have jar dependency code which I am not able to change which accepts a
Flow[Array[Byte],Array[Byte],Any]
which is what is provided by Play for a WebSocket connection. In Akka HTTP the definition is
Flow[Message,Message,Any]
I need a translation between the 2 definitions. I am new to Akka http so I am not exactly sure how to proceed. In play I was also using ActorFlow.actorRef
handleWebSocketMessages(wsFlow)
def wsFlow: Flow[Message, Message, Any] = {
ActorFlow.actorRef(websocket => MyBridgeActor.props(websocket))
}
ActorFlow code only has a dependency on akka so I have just copied the file to my own code base. https://github.com/playframework/playframework/blob/master/framework/src/play-streams/src/main/scala/play/api/libs/streams/ActorFlow.scala
I guess a solution would be to create a CustomActorFlow which will includes the conversion from Message to Array[Byte]. MyBridgeActor accepts the websocket in Flow[Array[Byte],Array[Byte],Any] format.