scala - Play! 2 WS library : Detect and Handle Closed Connection in Streaming HTTP response -


in play ws library, using call process streaming http response:

 def get[a](consumer: responseheaders => iteratee[array[byte], a]):      future[iteratee[array[byte], a]] 

i passing like: _ => (iteratee.foreach(chunk => println(chunk)))

everything works fine, @ point connection seems close , don't know how handle this. tried adding .mapdone print out stuff when iteratee done, never happens.

on request, how can detect connection has been closed , handle event?

it seems not longer problem in play 2.2.3. function passed map defined below should invoked unit when stream closes:

val connection = ws.url("http://example.com")   .get(_ => iteratee).flatmap(_.run) map { _ => println("closed") } 

Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -