(Nearly) Real Time River?

So one of my users asked me a question today that got me thinking:

Why do I have to refresh the activity river?

Why indeed?

It seems to me that for this kind of thing, the most obvious thing would be an automatically updating page, so nobody has to refresh. It would make it, in essence, the actually beating heart of an elgg installation, rather than just that place you go back to regularly.

That got me thinking even more. What if you put a "mini-river" in the corner of every page? Or in the sidebar? Or wherever your theme dictated? That way, a user could see things happening on the site no matter where they were.

This got me wondering: why isn't this already done? It seems like such an obvious, obvious step now I think about it.

Unfortunately, I know, if you'll excuse my French, bugger all about AJAX. 

Would there be any interest in this?

  • yep ;-)

    someone approached me about this AJAXified feature before. I gave some thought to exactly which portion of the index page should be AJAXed and at what interval. It will be interesting to see what this does to the load on the server though.

  • @ Dagorath - What about adding this as a distinct page element which could then be called per theme. Users could simply insert the elgg_view('page_elements/running_river', $vars) into the appropriate place in their theme's pageshell.php file. The plugin could even include a couple of placement options for standard layouts.

    @ Dhrup - I wonder if including an option to view only friend's activity would lessen the server load. You're probably right that the strain could be pretty big on sites with larger communities. I suppose for that matter any filter set on the plugin at the admin level would help keep things cool.

  • @Dhrup: Way I see it, it could actually decrease server load if done well. If you hit refresh on the riverdashboard page the same amount of times as we update it - and you don't really need more than say every 30-60 seconds, since it's not exactly live chat, and in fact on some sites could get away with even more latency than that - then you're reloading far more than just one or two lines of text. Probably something you'd want in the settings for the plugin itself, this.

    @chiinook: That's pretty much exactly the kind of thing I was thinking of.

  • Putting a 30 sec refresh on every page I think would give an unnecessary server hit

    100 users online = 200 refreshes +say 50 page navigation's times 60 minutes * 24 hrs =  360,000 page hits a day  

    this is increasing your load by over 400%

    small site big server = OK

    Why not a shout box

  • Nice Math MJ ;-)

    I actually coded this 1/2 way just for fun to prove a point for DeMyx who initially asked me re: "AJAXifying".. but then dropped the code because... server load situation..

    Does not really seem worth having my $5/month ( LOL ) Hosting Company kicking my Domain off to never-never-land. . .

    ( por el camino ... ¿cómo se le MJ mi amigo? )

    cómo son los niños? heh heh...

  • I am dealing with a Facebook like IM and I have the same concern. If you want to be informed when another user (or friend) tries to call you, all online user pages must be polling to the server every i.e. 10 seconds. Am I right? Are there any other way?

  • I run dedicated servers (one of which is hosting my site, one of which is hosting a memcache for my site with spare RAM) and own a webhosting set up and am -expecting- site growth anyway... currently I get up to 200,000 hits per day anyway, on images hosted for friends + my site. Server can handle it (with enough bandwidth/CPU time/memory for more), so it's not a biggie for me... but even updating every 2 minutes, we're looking at 144,000 hits per day. Mind you, if we just have text (say, no images in the river whatsoever), this isn't really a massive amount of actual data: overhead is the killer here.

    But still far less than if we have users reloading the page again and again and again.

    Perhaps have the riverdashboard static, but have a sitewide plugin that updates on activity of friends? If we had a way to only push data to the plugin WHEN there was an update in the database... that might cut data cost somewhat.

  • Reading about this -> http://www.freeliberator.com/

    It's a free server for pushing data to the clients.

  • I spent the day reading about push tecnologies, but no one seems to be simple to implement and most of them are in development or not really tested with many clients. A little dangerous for a production server. Please comment if you found something.

  • I've kindof on/off been doing some work on this (I have about 5 other things to do, hah). So far it doesn't look like it would be technically at all difficult to implement. The only problem is load.

    I wouldn't advise it for any large site with a large userbase unless costs aren't an issue (IE, user subscription would pay for bandwidth), though.

    If/when (if because I may decide it's not worth it in the end) I actually do this, I'll be sure to upload the plugin. :)

    (Doubt this'll be any sooner than at least 1 month from now - as I said, I have other things I'm working on that have higher priority... mostly because I'm getting paid for those, and my site is more a hobby currently... at least until I figure out things my users might be willing to pay for the use of. >.>)