refract streaming code
add some comments