【发布时间】:2021-03-12 07:54:17
【问题描述】:
我将 laravel-websockets 作为 systemctl 服务启动。
一切正常,但在我执行sudo reboot 直到 laravel-websockets 进程开始(我也使用nginx 作为反向代理)之后,应用程序上的客户端连接到推送器而不是我的套接字服务。
如果我清除 cookie 并刷新页面(在机器和所有服务启动后几分钟),客户端将按照应有的方式连接到 laravel-websockets。但前提是我清除了 cookie。如果我不清除 cookie,无论我刷新页面多少次客户端仍然连接到推送器。
在开发工具网络选项卡中:
https://sockjs-eu.pusher.com/pusher/app/....
代替
https://socket.mydomain.com
在我的推送应用程序中,我关闭了客户端事件。但是在 laravel websockets 中我有它们。我确定客户端正在连接到 pusher,因为我在错误控制台中得到了这个:
To send client events, you must enable this feature in the Settings page of your dashboard.
我也将 laravel queue worker 作为 systemctl 服务启动。这可能与它有关吗?他们应该按顺序开始吗?
编辑
window.Echo = new Echo({
broadcaster: 'pusher',
key: process.env.MIX_PUSHER_APP_KEY,
cluster: process.env.MIX_PUSHER_APP_CLUSTER,
wsHost: 'socket.mydomain.com', //this is not the real domain
wssHost: 'socket.mydomain.com', //this is not the real domain
wssPort:443,
forceTLS: true,
disableStats: true,
});
【问题讨论】:
-
您可以添加您的代码
new Echo({})吗? -
@Kamlesh Paul 我在编辑中添加了它。我只是更改了不想公开的域。
标签: php laravel websocket pusher