之前Nodeloc一直用的 Pusher,但是Pusher只push主题和帖子更新,通知都需要刷新才能看到有新通知。
今天换了RealTime,是一个自建的WebSocket。
安装的时候还遇到了一个问题,提示
composer require blomstra/realtime:"*" -W
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Continue as root/super user [yes]? yes
Composer could not detect the root package (flarum/flarum) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
./composer.json has been updated
Composer could not detect the root package (flarum/flarum) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version
Running composer update blomstra/realtime --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- blomstra/realtime 0.2 requires pusher/pusher-php-server ^4.1.5 -> found pusher/pusher-php-server[v4.1.5] but these were not loaded, likely because it conflicts with another require.
- blomstra/realtime[0.2.1, ..., 0.2.10] require pusher/pusher-php-server ^7.0.1 -> found pusher/pusher-php-server[7.0.1, ..., 7.2.4] but these were not loaded, likely because it conflicts with another require.
- blomstra/realtime[0.2.11, ..., 0.2.18] require pusher/pusher-php-server ^7.2.0 -> found pusher/pusher-php-server[7.2.0, ..., 7.2.4] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires blomstra/realtime * -> satisfiable by blomstra/realtime[0.2, ..., 0.2.18].
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
这个提示让人摸不着头脑,官网问了下也没有明确说法,后来发下卸载 flarum/pusher
就可以了。
OpenLiteSpeed在后台创建网站的时候,要记住在端口监听那里把网站也加上,不然会404的。
由于Flarum RealTime使用的是WSS,那么443端口这里要加下域名。
然后在VHost编辑里边,websocket proxy
里边增加如下就好了
这个意思就是将请求全部转发到 127.0.0.1:6001
。
然后去Flarum的config.php
里边加上RealTime
的相关设置
'websocket' => [
'server-port' => 6001,
'js-client-host' => '*****',
'js-client-port' => 443,
'js-client-secure' => true,
'php-client-secure'=> false,
'php-client-host' => 'localhost'
],
好的,现在Nodeloc已经是基于RealTime
的无刷体验了。
只是首页的提示我并不喜欢,提示120秒后再次刷新有点多余了。
发表回复