I have
return request({
method: "POST",
url: response.stream.url,
json: true,
forever: true,
body: {
sessionid: response.stream.sessionid,
symbols: symbolParams
}
}).on("data", onData)
That gives me data whenever it comes through. But what if I want to STOP listening on that stream, how can I do that?
It seems to implement Readable Stream interface, so pause() and resume() work.
const request = require('request');
const req = request('http://google.com')
.on('data', data => {
console.log(data);
req.pause();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With