Private pub on heroku
Asked Answered
H

3

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!

Heinz answered 17/3, 2013 at 1:4 Comment(0)
S
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 .

Sodomite answered 23/3, 2013 at 14:31 Comment(3)
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?Heinz
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.Buckjump
@HareRam "NetworkError: 404 Not Found - jhgkjhgkr-9966.herokuapp.com/faye.js"Inaugural
H
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

Heinz answered 22/2, 2015 at 0:38 Comment(0)
T
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.

Threadfin answered 22/3, 2013 at 16:31 Comment(1)
Right, but how do I set up the one for faye? Will it be a normal rails app? What do I need to configure?Heinz

© 2022 - 2024 — McMap. All rights reserved.