Tuesday, 13 November 2018

Help! PM2 clustering, socketio and external APIs

I am a relative newbie to process management so kindly bear with me. I am running express using pm2 s clustered mode and have several instances spawned. I also need data from 3rd party APIs which I need to push to the client using socketIO. If I had only 1 worker, ideally this would be done right alongside express code but currently what happens is that the API is triggered 4 times thanks to clustering. How can I keep clustering separate while pinging data from the API and pushing to all connected clientsShould I run a separate script for this external API?How would socket IO send this data to the connected clients?Thanks in advance

Submitted November 14, 2018 at 04:01AM by mypirateapp

No comments:

Post a Comment