Realtime

Step up to make your Flarum forum realtime.

Realtime

Compatible with Flarum v1.1.1

Latest release 0.2.7-beta.1

9 subscribers

1,565 downloads

released on Feb 11, 2021

Tags

Realtime provides a self-hosted alternative to Pusher. It offers realtime updates of activity on your forum, not just for members but also for guests.

Features

  • Auto update of index (while keeping permissions & subscription states in mind).
  • Auto update of notifications (likes, replies, but also for flags).
  • New posts pushed into discussions.
  • Typing indicator.

Premium

Managed Flarum communities that we host on our platform (blomstra) will have access to all premium extensions we publish without additional cost.

Alternative you can see our plans on extiverse. After completing your order, check your active subscriptions and follow the provided instructions. Then install using:

composer require blomstra/realtime:*

Enable the extension inside the admin area and continue below with the Set up.

Set up

Method a) use the defaults

No action needed. Your websocket will re-use the configuration of your existing forum.

Method b) the config.php

Create a key websocket and override any of the configuration items as defined in Blomstra\Realtime\Websocket\Settings::rules().

Run the websocket server

For the websocket to run you will need to run its server. To do so for testing purposes, use:

php flarum realtime:serve -vvv --debug

This will boot the server and throw any debug information it can.

In production, you will need to set the websocket server to run continuously and restart when it errors. You can use a tool like supervisord for that.

# On Debian / Ubuntu
apt install supervisor

# On Red Hat / CentOS
yum install supervisor
systemctl enable supervisord

Now create a new file inside the /etc/supervisor/conf.d directory called realtime.conf with:

  • /var/www/flarum being the path to your Flarum installation.
  • www-data being the web user that runs your Flarum forum in apache, nginx or other web server software.
[program:realtime]
command=/usr/bin/php flarum realtime:serve
chdir=/var/www/flarum/
numprocs=1
autostart=true
autorestart=true
user=www-data
stdout_logfile=/var/www/flarum/flarum/storage/logs/realtime.log
stderr_logfile=/var/www/flarum/flarum/storage/logs/realtime-error.log

Now read the configuration file and start the service:

supervisorctl update

Check whether the program is running:

supervisorctl status

More information about supervisor and its commands can be found in their documentation.

Running encrypted

If you want to run the websocket server encrypted, the easiest way is to proxy the port with your webserver software (apache, nginx). Find instructions for these online or create a ticket at https://helpdesk.blomstra.net for assistance.

FAQ

Why yet another websocket extension? With realtime we wanted to lay a stable foundation for additional features. This foundation is made by keeping third party dependencies to a minimum, creating our own convention for event naming and payload generation, but also by re-using as much of the Flarum core code as possible. We needed a reliable and scalable websocket extension for our customers and realtime delivers.

How many concurrent users does realtime support? Resource usage of the websocket is really low. You should be able to serve thousands simultaneous users with only 1 cpu and 1 GB of memory dedicated to the process. Once we are able to provide a better indication from usage at scale, we will update this FAQ item. As a general rule of thumb it's always better to oversize your realtime daemon resource limitations and then - based on experience - reduce them to meet actual resource cost.

I have another question. Reach out to us via https://helpdesk.blomstra.net. We will get back to you as soon as we can. If you have a running subscription please mention when you started your plan and/or which plan you are on. Always add sufficient information when reporting errors. We prefer errors being reported here, but understand that sometimes you can't.


  • Blomstra provides managed Flarum hosting.
  • https://blomstra.net
  • https://blomstra.community/t/ext-realtime

© 2021 Hyn by DaniĆ«l "Luceos" Klabbers. All rights reserved. · Extensions and extension information is provided by the respective (copyright holding) authors. · Extiverse is not affiliated to the Flarum project or Flarum foundation. · Images on Extiverse pages are from Unsplash.