Step up to make your Flarum forum realtime.
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.
- Auto update of index.
- Auto update of notifications.
- New posts pushed into discussions.
- Typing indicator.
Managed Flarum communities that we host on our platform (blomstra) will have access to all premium extensions we publish without additional cost.
composer require blomstra/realtime:*
Enable the extension inside the admin area and continue below with the Set up.
Method a) the
Create a key
websocket and add the necessary array items as defined in
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
/var/www/flarumbeing the path to your Flarum installation.
www-databeing 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
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.
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.