added client side code for streaming