5

I am developing a chat application using rails 3.2.12 and a great gem called private pub, for which you can find a screencast here. It is built on top of faye and enables you to easily build real time chats by pushing messages.

Now, deploying it on heroku actually is not that simple with private pub. Apparently, you have to set up another app for the faye channel and then subscribe to that channel from your other app.

This is all very confusing. Neither private pub nor faye have anything about deployment on heroku in their documentation. I have found these two links:

However, I don't really understand them since they start at a more advanced level.

Has anyone of you ever deployed a private pub/faye app on heroku and can give a step by step guide? Thanks!

Community
  • 1
  • 1
Dennis Hackethal
  • 13,662
  • 12
  • 66
  • 115

3 Answers3

6

You can checkout my sample chat at github https://github.com/Hareramrai/batkaro. You can also checkout private_pub server code at github https://github.com/Hareramrai/fayeserver .

Hare Ram
  • 743
  • 2
  • 7
  • 19
  • Hare, thanks a lot! This works just fine. So it was really only setting up the barebones faye app on heroku and adjust the private_pub.yml production configuration in my original app. Awesome! One last question before I can accept your answer: Is it a good idea to use that faye server on heroku for different applications? Or should I use a different faye server for every different application? – Dennis Hackethal Mar 23 '13 at 20:29
  • Hi @HareRam, I've configured the same in my case,My app push the data to fayeserver running as separate heroku app, but I'm not able to receive the message pushed to channel, it shows that "WebSocket is already in CLOSING or CLOSED state". Can you please suggest any thing? Thanks in advance. – Niral Munjariya Dec 09 '14 at 11:17
  • @HareRam "NetworkError: 404 Not Found - http://jhgkjhgkr-9966.herokuapp.com/faye.js" – Mani Dec 17 '15 at 20:46
2

If someone is looking for a more up to date answer, I just released a gem that enables real time behavior in a Rails app:

https://github.com/dchacke/entangled

Dennis Hackethal
  • 13,662
  • 12
  • 66
  • 115
1

It sounds like, from the articles that you linked, that you need to have two web processes running. One for the normal web server, and one for the Faye server.

It may be easier to have two Heroku apps rather than trying to get each running within the same app.

jordelver
  • 8,292
  • 2
  • 32
  • 40