Hello! My server side:
def update: Iterator[ByteString] lazy val binding = StreamTcp(system).bind(address, idleTimeout = 20.seconds) def start(): Future[Unit] = { val firstCompleted = Promise[Unit]() val foreachConnection = ForeachSink[IncomingConnection] { connection => val handleConnection = FlowGraph { implicit b => import akka.stream.scaladsl.FlowGraphImplicits._ val updateSource = Source[ByteString](() => update) val broadcast = Broadcast[ByteString] updateSource ~> broadcast broadcast ~> connection.flow ~> BlackholeSink broadcast ~> OnCompleteSink[ByteString] { res => firstCompleted.complete(res) } } handleConnection.run() } val connectionsMap = binding.connections.to(foreachConnection).run() firstCompleted.future.flatMap {_ => binding.unbind(connectionsMap)} .recoverWith { case ex => binding.unbind(connectionsMap).flatMap(_ => { Future.failed(ex) })} } If i have exception on the client side, this future will be completed with Success anyway. Is there a way to handle tcp exceptions (client disconect for example) ? -- >>>>>>>>>> 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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.