Abonnez-vous à plusieurs canaux à l’aide de l’API Faye – Podio

Voici le code actuel (abonnement à un seul article)

podio.authenticate('password', { 'username': podioUser.username, 'password': podioUser.password }, function (response, body) { const item_id = 1234567; podio.get('/item/' + item_id, {}, function (response, body) { push.addSubscription(body.push); }); }); 

Voici le code complet,

 // Initialize faye client var fayeClient = new faye.Client('https://push.podio.com/faye'); // Extend faye client with signature and timestamp used for authentication fayeClient.addExtension({ 'outgoing': function (message, callback) { message.ext = message.ext || {}; message.ext = {private_pub_signature: push.channel.signature, private_pub_timestamp: push.channel.timestamp}; callback(message); } }); const push = { subscription: null, channel: null, addSubscription: function (channel) { this.channel = channel; this.subscription = fayeClient.subscribe(this.channel.channel).withChannel(function (channel, message) { var client = new faye.Client('http://localhost:8000/'); client.publish('/messages', { text: message }); }); this.subscription.then(function () { console.log('Subscription is now active'); }, function (error) { console.error('Subscription failed: ', error.message, error); }); } }; podio.authenticate('password', { 'username': podioUser.username, 'password': podioUser.password }, function (response, body) { const item_id = 1234567; podio.get('/item/' + item_id, {}, function (response, body) { push.addSubscription(body.push); }); }); bayeux.attach(server); server.listen(8002); 

Est-il possible de souscrire plusieurs éléments? J’ai essayé de l’identifier en boucle et de m’inscrire, cela ne fonctionne pas.