How to enable realtime chat with node.js and socket
How to enable real-time chat with node.js and socket
- First of all, you should have root SSH access to your hosting server.
- You need to install a node server on your hosting server. After successfully installing you can check the node version through the command (node -v).
- You need to install npm packages on your hosting server. After successfully installing you can check the npm version through the command (npm -v).
- You need to install the (pm2 service globally) to start the node application you can install it through (npm install pm2 -g).
- Go to the plugin installed node-server directory.
- Update the npm packages through this command (npm update).
- For the HTTPS server you need your server SSL certificate key and private key, you can get them from your server installed SSL directory if you have an HTTP server you can skip this step.
- In the plugin installed node-server directory, you will have to add the server port id and hostname in the .env file, edit the .env file and add the port id and hostname of the server.
- For the HTTPS server in the plugin installed node-server directory go to the sslcert directory, here you will find dummy_ssl_cert.crt && dummy_private.key files, edit these files and put the SSL private key in dummy_private.key file and then put the certificate key in the dummy_ssl_cert.crt file, after that please rename the files and remove the *dummy_* keyword from the files name.
- Please add the port id and hostname in the wpguppy admin real-time chat setting and enable the socket -io option. (Note port id and hostname should be the same as you put in the .env file).
- Then you need to start your node application, if you have an HTTPS server then you will run the command (pm2 start server-ssl.js) otherwise you need to run the command (pm2 start server.js). After that check the status of your pm2 server through command (pm2 status).
- Your node server is successfully configured please test your wpguppy plugin for real-time chat, in case of any issue please contact your server manager.