• Dev
  • Notifications and Refresh without Pusher, etc.

I've been wondering about this as well recently. I hadn't bothered to look into Pusher, and didn't even realize it was a third-party service until @Toby mentioned it in response to a query about page update behavior.

I'm hoping Flarum won't be too reliant on third party solutions that an admin may or may not want to use.

I'm not interested in shelling out a lot of cash to host this. Assuming if I ever get as much as 200 members and some visitors. I wonder if that pusher will be replaced once a few experiments are done.

Here's some alternatives. Haven't tested any of them but Firehose looks good.
According to the sandbox install, disabling should be as easy as this.
alt

Fastidious Why can a pusher not be locally hosted? The current plugin doesn't permit but I fail to see why the pusher must be located somewhere else on a different server.

    Kulga Why can a pusher not be locally hosted? The current plugin doesn't permit but I fail to see why the pusher must be located somewhere else on a different server.

    Pusher is a service. I really do not know any other way to answer your question.

    Kulga According to the sandbox install, disabling should be as easy as this

    Disabling it was never a worry, I know extensions can be disabled (and I have played on the "Sandbox" as well). But once disabled, the functionality it covered is gone.

    Kulga The point is as what Fastidious talked about already is it's a 3rd party service. And the functionality is gives would be gone. Basically what fastidious said.

    But to add.. the functionality it offered shouldn't be gone just because we don't want to use a 3rd party service.

    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.