I need to replace pm2 with @socket.io/pm2.
I followed the instruction at Usage with PM2 | Socket.IO and removed pm2 and installed @socket.io/pm2 globally. But then my strapi installation is not starting anymore.
Reverting to pm2 brought back strapi. But I use the strapi-plugin-io which is not working with pm2. How can I replace pm2 and get socket.io working?
I am still struggling with that. The socket exists, but the client does not get all messages from the strapi endpoint.
In development enviroment it works perfectly, so I guess it is the nginx proxy. I tried differnet configs, but no success. There is no entry in the error log of the strapi nginx error logfile.
How can I debug this? What could be the problem? My last strapi nginx config:
It is the cluster mode in pm2.
I turned off the ngnix proxy and switched the socket.io client to transport “polling”. The problems remained. However, the browser console now showed “unknown Session ID” errors. This also got me tracking down the cluster mode in pm2. I am using a cloud server with 2 CPUs. Now when a request started from the first CPU but the response is sent from the second CPU, the socket.io message no longer arrives at the client because it is a different session. Turning off cluster mode in pm2 and limiting it to one CPU solves the problem.
instances : "1", // change the value to "1" if your server has only 1 CPU
// exec_mode : "cluster_mode", // remove this line if your server has only 1 CPU
Now it works with the nginx proxy settings documented at socket.io: