Using akka-http, how can I construct a Flow[Message, Message, _]
to pass tohandleWebsocketMessage that only listens to incoming data but does not write anything back? Is it possible to use a Sink in anyway? Because a Sink sounds like what I need.
2
votes
1 Answers
4
votes
It's possible to create a Flow from independent Source and Sink, which is what you'll need here. To get more inside info about how it can word you may want to read the stream composition docs.
In general what you need is to create a Flow such that it is a Sink that can handle the incoming messages and a Source that never emits, this is achieved by:
Flow.wrap(Sink.foreach(println), Source.lazyEmpty)(Keep.none)