Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polling for latest topics using Rails 4's new live streaming #617

Open
ghost opened this issue Nov 2, 2014 · 2 comments
Open

Polling for latest topics using Rails 4's new live streaming #617

ghost opened this issue Nov 2, 2014 · 2 comments

Comments

@ghost
Copy link

ghost commented Nov 2, 2014

Hi!

Has anybody ever added polling for latest topics using Rails 4's new live streaming to Forem and could share some info on how they did it?

StackOverflow, Quora, Disqus etc. all do it so I thought it'd be nice if Forem could too. I've begun working on some pseudo code here and would really appreciate some feedback:

https://gist.github.com/richwhiteguy/94eb5139d3319a8a5c62

@radar
Copy link
Collaborator

radar commented Nov 3, 2014

Not that I am aware of. If you'd like this feature in Forem then a PR would be the best way to get it there. Please submit one when you're done and I'll take a look.

@ghost
Copy link
Author

ghost commented Nov 19, 2014

Thanks, but I'm not so sure I want to proceed with live streaming after all. Got this feedback from this friend just now:

I got slightly farther than Aaron Patterson's article, but I was so annoyed by the multithreading and how it worked and didn't that I mostly stopped there.

I had to turn on Rails thread-safe mode to get it to work, but in Rails 4 that requires turning on class caching, which is a pain.

I then moved on to trying to do similar things using websockets or Faye -- both are also annoying, and require multithreading or EventMachine or Celluloid :-(

jQuery polling is massively easier. I was just emailing a guy yesterday that had a worst-case situation -- doing every-5-second AJAX polling on his Rails server with big HTML tables that bogged down and took forever to render.

And you know what? All he has to do is semi-sane caching and it'll be pretty reasonable. ETags or last-modified headers plus Rails view caching and he's fine. The 304-unmodified responses are small enough that they're not a big deal at any reasonable number of users. There's a variation on that where you write cache files and tell NGinX to respond according to its last-modified date that's even faster.

The alternative is http://railscasts.com/episodes/229-polling-for-changes-revised -- thoughts anybody?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant