PHP code example of flarum / realtime

1. Go to this page and download the library: Download flarum/realtime library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flarum / realtime example snippets


return [
    // ..
    'websocket' => [
    
    ] 
];

return [
    // .. some other instructions
    
    // Make sure the Realtime php client uses localhost instead of the domain
    // to reduce latency.
    'websocket' => [
        'php-client-host' => 'localhost'
    ]
];
bash
php flarum realtime:serve -vvv --debug

[Unit]
Description=flarum-realtime
StartLimitIntervalSec=0

[Service]
Type=simple
User=www-data
WorkingDirectory=/var/www/flarum
ExecStart=/usr/bin/php flarum realtime:serve
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target
bash
php flarum realtime:serve --ignore-extension-toggles
bash
php flarum realtime:halt
nginx
server {
  # your php matching instructions