Notifications and Refresh without Pusher, etc.
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.
- Edited
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.
- Edited
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.
- Edited
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.
- Edited
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.
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
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.
AFAIK Slanger isn't designed for production use.
Consider https://github.com/dimiro1/ipe as an drop-in alternative to Pusher.
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.
- Edited
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
- If not, remove it and make sure to remove all existing files related to it
- Download golang and it's GOPATH variable is exported correctly (wherever go is installed to) - I extracted mine to /usr/local/go
- Make sure the go command works
- If not, remove it and make sure to remove all existing files related to it
- 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.
anyone has experience with http://socket.io/
i guess its a god alternative to pusher.com
- Edited
I think telepat http://telepat.io can be installed locally and used instead of pusher.