I configured it similarly to Wadera, but on a LiteSpeed server, so I added such an .htaccess
file in the subdomain:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ http://127.0.0.1:6001/$1 [P,L]
I can see that it is receiving requests, because when I go to the forum, the logs appear (php flarum realtime:serve -vvv --debug
):
New connection opened for app key bbb8de9ab2ed78a2c1ba434cf0c6582e.
Connection id 295737913.839496198 sending message {"event":"pusher:connection_established","data":"{\"socket_id\":\"295737913.839496198\",\"activity_timeout\":30}"}
New connection opened for app key bbb8de9ab2ed78a2c1ba434cf0c6582e.
Connection id 557563191.828092975 sending message {"event":"pusher:connection_established","data":"{\"socket_id\":\"557563191.828092975\",\"activity_timeout\":30}"}
New connection opened for app key bbb8de9ab2ed78a2c1ba434cf0c6582e.
Connection id 906666710.882620565 sending message {"event":"pusher:connection_established","data":"{\"socket_id\":\"906666710.882620565\",\"activity_timeout\":30}"}
New connection opened for app key bbb8de9ab2ed78a2c1ba434cf0c6582e.
But in the browser I have this warning and new posts do not appear in real time:
WebSocket connection to 'wss://*******/app/bbb8de9ab2ed78a2c1ba434cf0c6582e?protocol=7&client=js&version=7.4.0&flash=false' failed: WebSocket is closed before the connection is established.
When the websocket is not running on suddomain then I have connection error instead of the above warning, which indicates that partially this websocket is working.
Flarum queue is working.
My config:
'websocket' => [
'server-port' => 6001,
'js-client-host' => '*******',
'js-client-port' => 443,
'js-client-secure' => true,
'php-client-host' => '*******',
'php-client-port' => 443,
'php-client-secure' => true,
'php-client-timeout' => 20
],
In this post content, I replaced the real domain with *
, but the host is correct in the real config.