periodic invocation of flush/read in separate thread added to response for heartbeat messages; client synchronized