• Dev
  • Notifications and Refresh without Pusher, 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.

            ashconnor So I figured I'd try and install it.
            It was a bit of a PITA to get it running... but my experience is:

            • Ensure your go (golang) version is greater then 1.1
            • Follow this guide and ensure you have a file named config.json with at least the sample config in your current directory when you run the ipe command

            I also added this to /etc/bash.bashrc to ensure my shell knew where everything was since it wasn't setup automatically for some reason (probably because I had to manually install golang) - you may or may not need to do this.

            # Path
            PATH=$PATH:/usr/local/go/bin
            ## Exports
            
            # Golang variable
            export GOPATH=/usr/local/go/

            Hopefully that helps.. a lot of the errors I got weren't especially clear


            I should note that IPE apparently permits multiple application id's in one config... that could be very useful for splitting up multiple pusher (flarum) installs. Unfortunately, there's not much documentation for the config... but my guess is it's my limited understanding of pusher that's hindering me as to what each of the config options do.

              6 days later

              Kulga Looks like most of your issues were just setting up Golang. Setting up Go is a PITA as it expects certain variables to be set and specific folder structure.

                seenu I've used socket.io quite successfully for node.js based web projects, the automatic fallback to long polling when websockets are unavailable to the client or are blocked by an intermediate party are very nice.

                I'm not sure how integrating it with the PHP code in Flarum would work as last i checked there were no language bindings for Socket.io other than Node.js. If there are now language bindings for PHP it would be something to look into.

                  seenu possibly, possibly.

                  I'd have to investigate it more to determine if it would be a good library to use for Flarum.

                  You can also make websocket servers using nginx..

                  The problem is pusher uses a specific way of working with websockets, including authentication on private and presence channels. In order to implement such a thing using a vanilla websocket server is like re-inventing the wheel. If you need alternatives for pusher, I recommend googling for searching exactly that and finding amongst others slanger.

                  5 months later

                  ashconnor I am the author of the ipe pusher server library, I just add binary downloads for linux and OSX, please take a look at https://github.com/dimiro1/ipe/releases.

                  After downloading just configure the already provided configuration in config.json and start the server running ./ipe on the terminal.

                  If you have any more questions, please open a issue on the project page.

                  Thank you for your interest in ipe.