Realtime

Step up to make your Flarum forum realtime.

Realtime

Compatible with Flarum v1.0.3

Latest release 0.1-beta.31

0 subscribers

699 downloads

released on Feb 11, 2021

Tags

  • blomstra

  • realtime

  • websocket

  • typing indicator

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.
  • Auto update of notifications.
  • 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) the config.php

Create a key websocket and add the necessary array items as defined in Blomstra\Realtime\Websocket\Settings::rules().

Method b) use the defaults

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

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 /var/www/flarum/flarum realtime:serve
numprocs=1
autostart=true
autorestart=true
user=www-data

Now read the configuration file and start the service:

supervisorctl update && supervisorctl start realtime

Running encrypted

If you want to run the websocket server encrypted, the easiest way it 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? The kyrne/websocket extension is a great piece of software. Blomstra Realtime has less dependencies on third party packages and has been written to work behind a proxy by default. Keeping the code in-house also allows us to develop features for it much faster. In addition we decided to re-use existing Flarum code and change the convention of sending events; Realtime events re-use the Authorization Gates (visibleTo), the Serializers and dispatches events using the class name of the event.

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

© 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.