After looking closer at this, the reason is that when the Source completes, the socket gets closed and this is because websockets do not really support half-closed mode, where only one direction is still open. The more or less exact six second before closing is caused by two of the hardcoded 3-second timeouts inside of the websocket protocol stack in Akka HTTP.
We are discussing if we can provide a nice API to hide this, but have not arrived on a decision yet. To avoid this you can make sure the source does not complete until you want it to, for example by using Source.maybe like this: val outgoing = Source.single(TextMessage("out")).concatMat(Source.maybe)(Keep.right) This will materialize into a promise that you can complete or fail whenever you want to kill the connection from the client side. -- Johan Andrén Akka Team, Lightbend Inc. -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at https://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.