Here is my code.
this class is called as child process using the child_process module and
passing a message as parameter.
I hope this is clearer
again thanks for any lead
var pub = require('publisher');
var async = require('async');
process.on('message', function(message) {
var news_box_post = {
message: message.query.display_text,
link: message.query.link
}
pub.setAccessToken(m.access_token);
function do_api_call(news_box_id, callback){
pub.post(news_box_id, news_box_post, function(err, res){
if(res) console.log("Published in " + news_box_id);
if(err) console.log(err)
});
}
async.forEachSeries(m.query.news_box_id, function (object, cb) {
do_api_call(object, function(err) {
if (err) return cb(err);
setTimeout(cb, 5000);
});
}, function (err) {
console.log(err)
});
});
--
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.