Created
December 30, 2015 20:15
-
-
Save tastywheat/6e60d55a0fece7715902 to your computer and use it in GitHub Desktop.
client http persistent connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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