-
-
Notifications
You must be signed in to change notification settings - Fork 934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moving from Request to got: Twitter Stream drops for no reason. #865
Comments
Duplicate of #223
I've got trouble understanding this sentence. Can you elaborate please? I strongly recommend reading the full documentation + this Request migration guide. |
Screwed my grammer there. I run the GOT version and the Request version side by side. The GOT version dies very quickly. But the request version keeps running fine (no stall). I didn't see anything relevant in the Migration Guide, hence this open issue. I'll take a loot at 223 and see if it helps. Thank you. |
It's definitely because of #223. The main stream is blocking flow. You need to resume it: .on('response', function(response) {
console.log('Got Response');
response.setEncoding('utf8');
response.on('data', function(chunk) {
console.log('data', chunk.length, new Date());
if (chunk == "\r\n") {
console.log('Ping');
} else {
console.log('A Chunk');
parser.recv(chunk);
}
});
- });
+ }).resume(); If it doesn't work, please let me know, I'm happy to help :) |
Finally got around to testing. Can confirm that .resume() has fixed the issue. Thank you! |
@szmarczak Maybe we should add a tip about this in the readme? Seems like a common mistake that is easy to fall for. Maybe the Tips section with an example? |
That's right. I'll send a PR. |
What would you like to discuss?
I'm in the middle of converting from Request to Got.
But for whatever reason, the Stream just drops with Got but not with request.
The only difference between my code is requiring got instead of request.
Sample code:
At this point I can't see any issues or bugs, just my "got" version stalls for no reason, where as the "request" version keeps going and going without issue. So I'm stuck.
Sure my code is missing the keep alive/auto reconnect logic, but I'm because in testing the Got version only sticks for 5/10 minutes max, where as request version I have days. I'm looking at Got being the issue?
Checklist
The text was updated successfully, but these errors were encountered: