• Dev
  • Notifications and Refresh without Pusher, etc.

I'm a bit confused as to why autoloading of threads and notifications ever relied on a 3rd party service. That seems slower than actually running it on a local server. Is it because they are worried about bandwidth usage on shared hosts?

Since it is an extension in the first place, I don't see it being hard to create an extension with the same functionality but with a local solution. I don't even see a reason to use a 3rd party alternative to pusher, it can just be native code in the technologies already used by Flarum.

I would have assumed they would at least offer the user to use Pusher or some other service (for the shared hosting admins), or a self-hosted one (for the more experienced admins). With it being a setting in the admin panel or something.

A list of real-time technologies, some that can be used as alternatives, both hosted and self-hosted can be found http://www.leggetter.co.uk/real-time-web-technologies-guide

6 days later

The reason we've made a Pusher extension is for speed of development. We just want to get beta out the door, then we'll focus on other options etc.

In fact, you can self-host a Pusher implementation with Slanger.

    Toby

    I checked it out - I got a slanger instance running in about 15 minutes on a debian server.
    In case anyone's curious -
    Had to compile a 2.1.2+ ruby instance (apt-get gives 1.8 something)
    Then install these gems:

    Then..
    1. redis start
    2. slanger --app_key 765ec374ae0a69f4ce44 --secret your-pusher-secret


    Cool - hopefully the pusher extension will be modified soon to permit pointing to a local install.

      Kulga I checked it out - I got a slanger instance running in about 15 minutes on a debian server.

      Cool! However, it sounds like this could be hard to manage on a run-of-the-mill shared hosting account.

      Let's keep hoping @Toby and @Franz will come up with a widely applicable out-of-the-box solution as well. 🙂

        Dominion They might have something in mind but it seems like the best out of box would be using the pusher service already supported.
        I mean, that's the point of pusher, to provide a 1-2-3 service for a fee. I mean, you get 20 concurrent without charge.
        By hosting your own, you obtain the responsibility of managing it but don't rely on a third party service (and its cost)

          Kulga They might have something in mind but it seems like the best out of box would be using the pusher service already supported.

          As I mentioned earlier, some admins may have reasons they would not want to use a third-party hosted service. So that would not be the optimum out-of-the-box solution.

            11 days later

            Dominion I've been thinking about this..
            I hate to keep referring to wordpress.. but they have a wp-cron.php file that when run, causes it to "update" - so to speak. By default, every action you do on a wordpress site causes wp-cron.php to run.
            This is really, really inefficient but also moderately effective and as you might mention - very out of box supported.
            The problem is, php programs have no sense of time. It is a server-side renderer that generates html pages. This is worsened by the fact that flarum doesn't even refresh when you go from page to page (this is why notifications don't show up until you refresh the page - I noticed this for much longer with noscript).

            Because of that, it's impossible for flarum to mimick what a pusher service provides. Any attempt will have to be a hack (like wp-cron.php) and be hard-coded to pull content on certain clicks. Should it do it on every page scroll? Clicking on discussions? Doing nothing would result in nothing ever showing up as a notification and is almost guaranteed to result in slower page loads (since it's doing more) and potential scaling issues (flarum-cron.php being run every half second on a busy site?) something has to tell flarum that something has changed, please run code to update it.

            Both toby and franz are devs that know magnitudes more then me about php coding, so maybe they have some idea of circumventing wordpress's (and piwiks) best implementation of dealing with the php and time issue.

            But as it stands, I'm sorry to say this, but if you're on a shared hoster, or simply don't want to know how to start and configure services outside of a webserver, you're going to be stuck. There are solutions, but I wouldn't call them optimal :\, or even if they would work as a forum notifier..


            I'm aware that pusher is planning to be rewritten, but it looks like it's primarily focused on other components. I'm hoping it can be slightly modified to permit designating a ip address and port @Toby. If they both follow the same protocol, then it should be a drop in replacement (pusher.com -> slanger, etc) and I can get to testing how well it works, bugs, etc.

              After having read most of this thread I'd like to clarify some technicalities.

              It's very nice to talk about pusher and slanger without knowing what they facilitate. To keep it simple (which it is), both use the same piece of javascript. So switching between those server endpoints is as easy as changing the configuration of listenening and serving.

              Websockets are continuous connections between machines. They can be used to send over data whenever you like. Normal behaviour is that any visitor on a website is registered on some channels and php sends data to these visitors whenever necessary. There are a lot of benefits to using websockets, to mention some:

              • truly knowing whether someone is online (green circles talked about around avatars are exact)
              • no continuous requests to the server asking questions (ajax)
              • direct notifications, not every x minutes, about updates on threads

              To give you some dimensions of use, some of you might know battlelog by EA; it uses pusher almost solely. At work I also implemented websockets (at first slanger, proving less stable we moved to pusher) which notifies accounts immediately about any finished tasks once done, shows us a list of all online accounts in real-time and shows us a dashboard of open tickets.. The application is endless using websockets.

              I'm a big fan of websockets.

              Ps please be aware that pusher is more stable, it also caps maximum payload data. So switching requires you to understand the max length of the data you're sending.

                luceos I think the issue is not the usability of Websockets (they're great!), but the fact that pusher is a paid app. And on top of that, the user has to embed a 64KB js file as well? That's not right.

                And to put icing on the cake, the free version allows for only 20 connections?

                I'd personally rather just use nodejs and the ws module here. (And use the normal html 5 websocket connection api that's like 2 lines of code) Much, much better.

                  Wombat i understand what the issue is, that's why i tried to vouch for it. But i understand that it's not always nice to be stuck to additional costs.

                    luceos Pusher.com is definitely not bad. But I'm more focused being able to host my own that gets away from arbitrary limits - not to mention I like to control where my data flows and being able to configure it as needed.

                    However I just noticed this in flarum/features/

                    Enable Pusher integration to have new posts and discussions appear as they happen. Self-hosted push coming soon.

                    Guess it's coming up. I can wait then 😛

                      Kulga luceos Thanks for the discussion of the issues involved, very enlightening.

                      Kulga Enable Pusher integration to have new posts and discussions appear as they happen. Self-hosted push coming soon.

                      Perhaps @Toby can enlighten what this means. Otherwise I would have started some ideas to make a donation based (or otherwise less costly) pusher service for flarum forums.

                      We'll be making the Pusher extension's host/port configurable so that people can self-host Slanger (if they have a VPS) and hook it up to that.

                      We also may do a short-polling implementation like esoTalk for people on shared hosts who don't want to pay for Pusher. Although, this is low priority: Arguably, if your community is bigger than Pusher's free plan can handle, it's probably a good time to move off of a shared host and onto a VPS.

                      ashconnor How is its performance, stability, reliability?
                      I'm up for whatever the best is, but untii I start testing them, they're more or less equal unless someone else has tested them.

                      I haven't benchmarked it but it is written in Go so I'd expect performance to be good.

                      Possibly use it for dev and then switch to Pusher if performance is an issue?

                        ashconnor Possibly use it for dev and then switch to Pusher if performance is an issue?

                        I don't see myself using pusher on even the lowest tier of pricing (not including free). $20/month is far too high for 100 concurrent when 20 is free. Maybe at $3-4/month for 100. (or a middle level of 40 for $4/month)
                        Granted, I'm sure they're a great company and they may of adjusted their pricing accordingly, but when my VPS is $4/month, it would make much more sense (to me) to upgrade to a much higher level VPS and run a (or multiple of) pusher implementations to load balance then use it all on a pusher service (something I consider more of a luxury then a necessity)
                        I greatly prefer keeping my users data in house as well..

                        However, if you don't want to fight with fairly new software and want it to just work without hassle.. I say go for it.