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

Line ending issue with Mercurial or Visual Studio -

R - Plot: How to format in 10-base scientific notation and put it text, mtex, title etc functions? -

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