Streaming API sample code