superagent
サーバーから通知ストリームを受信するために使用しています
require('superagent')
.post('www.streaming.example.com')
.type('application/json')
.send({ foo: 'bar' })
.on('data', function(chunk) {
console.log('chunk:' + chunk); // nothing shows up
})
.on('readable', function() {
console.log('new data in!'); // nothing shows up
})
.pipe(process.stdout); // data is on the screen
何らかの理由data
でreadable
イベントが登録されていませんが、データをスクリーンにパイプできます。オンザフライでデータを処理するにはどうすればよいですか?