From: Stefan H. <hel...@gm...> - 2010-04-15 13:29:33
|
Hello, I would like to know the recommended way to detect when the client disconnects from an HTTP streaming session. I am currently using yaws_api:stream_chunk_deliver analogous to the first example given on http://yaws.hyber.org/stream.yaws. It is just that my stream is infinite (not finite as in the example given) thus the server will read content and stream it forever or until the client terminates the connection. By looking at the API however I do not see any easy way to detect when the client terminates the connection, thus my process will continue to loop and do stream_chunk_deliver forever, making my yaws machine slower and slower over time. I have looked into older posts on this mailing list and I see that there was a similar discussion around 2005 which discussed possibilities of detecting yaws-process dying by spawn_linking the streaming process. I have tried this however and it does not seem to work for me. I do not get any message passed to me when the client disconnects. Anyone who has any idea on how to do this in an elegant way? Any example code? Regards, Stefan |