Hi,

you are applying the `alsoTo` clause to the wrong side of the connection. 
You need to put it on the Sink-side. The way you have written it, the 
`alsoTo` clause waits for your `Source.actorRef` to close the connection.

Try using

singleWebSocketRequest(..., 
Flow[Message].alsoTo(Sink.onComplete(...)).via(yourHandlerFlow))

Johannes

On Wednesday, September 28, 2016 at 3:23:36 PM UTC+2, Alexej Haak wrote:
>
> Hi,
> I have a problem detecting a failing websocket. I already got some help 
> inside the akka issue tracker, so thanks for getting me started there even 
> though it was the wrong place :
>
>  val source = Source.actorRef[Message](bufferSize, OverflowStrategy.fail)
>
>  val flow = Flow
>     .fromSinkAndSourceMat(sink, source)(Keep.right)
>     .alsoTo(Sink.onComplete(_ => {  // Not working as expected?
>       println("Restarting due to Websocket failure..")
>       println("------------------------------------------------- \n\n\n\n")
>       restart()
>     }))
>
>  val (upgradeResponse, actor) =
>     Http().singleWebSocketRequest(
>       WebSocketRequest(
>         host + "/console"),
>       flow)
>
> The alsoTo part never triggers, even though the websocket connection 
> closes. I'm Testing it in this setup:
>
> - Play Framework Server with websocket running
> - Client Connects
> - Messaging works
> - Play Framework Server gets restarted
> - Messaging fails and no Client connects
> - Restarting Client manually
> - Messaging works again
>
>
> Best regards :)
>

-- 
>>>>>>>>>>      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.

Reply via email to