I am working on a project that makes heavy use of REST apis ( youtube, wikipedia, etc) through HTTP package, but is becoming unefficient due to the lack of an abort or stop method
Which options (workarounds? hacks? Npm packages) i have to get through this? BTW all calls are made on server side
To give you a proper answer (I don’t understand how you can try to answer a question when you don’t understand the question, @karina):
Per the docs, all http calls serverside call the npm module request.
You should be able to do something like what you want if you’re willing to use the npm module directly.
This SO answer seems up your alley: http://stackoverflow.com/questions/21148359/nodejs-miekal-request-how-to-abort-a-request
Or take a look at this npm package: https://www.npmjs.com/package/restler
Txs a lot, i will try that package out! BTW would be great if HTTP includes an abort() method…
I’ve just had a need to allow a user to abort an upload via HTTP and was looking for an abort function. It seems Meteor doesn’t have one, which seems strange. Is there a reason for not implementing one?
well, for larger uploads it is always better to use some chunked upload, so pure http is not always best.
Or you can always loop many HTTP’s over chunks of files as sync, than u will be able to cancel in between HTTP’s.
But I am working with YT and FB api too and only thing I was feeling like I need some cancel was due to blocking method call over DDP. And that is by default.
So if you want user to do more operations at once, you can use this.unblock and than methods will not block DDP and let the other method call to be executed in parallel from same client.
Just give me the request object of the call so that I can call request.abort().
request.abort() is part of Node HTTP: request.abort()