ruby-on-railstcpfayeconnection-refusedprivate-pub

Connection refused error faye port 9292 private_pub gem


I am working on a Ruby on Rails application that uses the gem Private Pub (https://github.com/ryanb/private_pub) to have a real time chat messages feature

This application is hosted in Digital Ocean and chat messages have been working correctly for a long time. However, around 1 and a half month ago it stopped working and I got an error on the console that says: GET https://fake-url.com:9292/faye/faye.js net::ERR_CONNECTION_REFUSED

First thing I did was to restart the Faye server using this command: bundle exec thin -C /data/app/shared/config/private_pub_thin.yml -d -P /data/app/shared/tmp/pids/faye.pid --ssl-disable-verify start (I run this command through Capistrano)

After running that command I checked /data/app/shared/tmp/pids folder and confirmed that faye.pid is there so process seems to be running

Then I ran sudo lsof -i -P -n | grep LISTEN to check open ports and 9292 port is listed

After that I reloaded the chat and got again the net::ERR_CONNECTION_REFUSED error

Then I checked the ports again and port 9292 does not appear on the list

So it seems like everytime I load the pages it closes the port or something like that.

NOTES:

Thanks in advance!


Solution

  • I ended up removing Private Pub gem and using Pusher to get the real time updates. Pusher was really easy to use. Thank you all!