This might be a bug, I have opened a ticket about it (https://github.com/akka/akka/issues/19957)
Thanks for letting us know! -- Johan Andrén Akka Team, Lightbend Inc. On Saturday, March 5, 2016 at 6:24:37 PM UTC+1, Brandon Bradley wrote: > > This is a good question! I was wondering the same thing. > > On Wednesday, March 2, 2016 at 7:07:31 PM UTC-6, Filipp Eritsian wrote: >> >> Hello all, >> >> Hoping someone can shed some light on the following! >> >> I am using the example provided with the documentation: >> >> object WebSocketClient extends App { >> >> implicit val system = ActorSystem("test") >> implicit val fm = ActorMaterializer() >> >> import system.dispatcher >> >> val incoming: Sink[Message, Future[Done]] = >> Sink.foreach[Message] { >> case message: TextMessage.Strict => >> println(message.text) >> } >> >> val outgoing = Source.single(TextMessage("")) >> >> val webSocketFlow = >> Http().webSocketClientFlow(WebSocketRequest("ws://localhost:9001/stats")) >> >> val (upgradeResponse, closed) = outgoing >> .viaMat(webSocketFlow)(Keep.right) >> .toMat(incoming)(Keep.both) >> .run() >> >> val connected = upgradeResponse.flatMap { upgrade => >> if (upgrade.response.status == StatusCodes.OK) >> Future.successful(Done) >> else if (upgrade.response.status == StatusCodes.SwitchingProtocols) >> Future.successful(Done) >> else >> throw new RuntimeException(s"Connection failed: >> ${upgrade.response.status}") >> } >> >> connected.onComplete(println) >> closed.foreach(_ => println("*** closed ***")) >> } >> >> >> The web socket client seems to close the http connection after about 6 >> seconds. Any way to make the connection stay open? The server I am using >> just publishes stats every second, continuously. >> >> Server log: >> [DEBUG] [03/03/2016 08:52:30.343] >> [websockets-akka.actor.default-dispatcher-3] >> [akka://websockets/system/IO-TCP/selectors/$a/0] New connection accepted >> [DEBUG] [03/03/2016 08:52:36.534] >> [websockets-akka.actor.default-dispatcher-2] >> [akka://websockets/system/IO-TCP/selectors/$a/1] Closing connection due to >> IO error java.io.IOException: Broken pipe >> >> Cheers, >> Filipp >> > -- >>>>>>>>>> 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.