Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Long Polling Practices

I am developing an app that allows users to post to rooms/pages, much like a forum or here (stackoverflow). I have already built out the entire app, however, I have one last obstacle to climb: How to handle updating posts for a user.

I have done alot of research into the topic, and I believe Long Polling is the way to go, at least until I get an immense amount of traffic (if that happens, I'll figure out how to implement websockets). This is because Long Polling will be easier to implement, it is more widely supported, and given that I am deploying to heroku it will be easy to upgrade my server resources quickly. Anyway, I wanted to know what the best practices are of long polling, both in terms of user interaction, and server load.

Should I automatically place posts on the page, or create an alert system such as the one here on stackoverflow?

Any and all input would be appreciated. If you think my logic is wrong in anyway, please tell me!

like image 217
flyingarmadillo Avatar asked Nov 12 '22 23:11

flyingarmadillo


1 Answers

For a system like this we suggest using something like pusher. Check out the documentation for more details as to how to do it. https://devcenter.heroku.com/articles/pusher

like image 151
Eric Fode Avatar answered Dec 20 '22 21:12

Eric Fode