Skip to content

Instantly share code, notes, and snippets.

@tastywheat
Created December 30, 2015 20:15
Show Gist options
  • Save tastywheat/6e60d55a0fece7715902 to your computer and use it in GitHub Desktop.
Save tastywheat/6e60d55a0fece7715902 to your computer and use it in GitHub Desktop.
client http persistent connection
import request from 'request';
import follow from 'follow';
// follow("http://127.0.0.1:5984/anything", function(error, change) {
// if(!error) {
// console.log("Got change number " + change.seq + ": " + change.id);
// }
// })
// request
// .get('http://127.0.0.1:5984/anything/_changes?feed=continuous&since=1&heartbeat=15000')
// .on('data', function(data) {
// console.log(data.toString());
// })
var r = request.get('http://localhost:3005/stream');
r.on('data', function (data) {
console.log(data.toString());
});
setTimeout(() => {
r.abort();
}, 5000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment