我把作为一种系统服务来启动。
一切都正常,但在我完成sudo reboot之后,直到laravel进程开始(我也使用nginx作为反向代理),应用程序上的客户端将连接到pusher,而不是我的套接字服务。
如果我清除cookie并刷新页面(在机器和所有服务启动后几分钟),客户端就会以应有的方式连接到。但前提是我要清理饼干。不管我刷新了多少次页面,如果我不清除cookie,客户端仍然连接到pusher。
在dev网络选项卡中:https://sockjs-eu.pusher.com/pusher/app/....而不是https://socket.mydomain.com
在我的推动者应用程序中,我关闭了客户端事件。但我用的是拉拉韦氏套餐。我确信客户端连接到pusher,因为我在错误控制台中得到了这个:To send client events, you must enable this feature in the Settings page of your dashboard.
我也开始使用laravel队列服务作为系统服务。这跟这事有关系吗?他们应该按顺序开始吗?
编辑
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,
});发布于 2020-11-30 11:50:54
试试这个配置
window.Echo = new Echo({
broadcaster: 'pusher',
key: 'broadcasting', // hard code
wsHost: window.location.hostname,
wssHost: window.location.hostname,
enabledTransports: ['ws', 'wss'],
wssPort:443,
forceTLS: true,
disableStats: true,
});在这里,key: 'broadcasting'使它成为硬代码,并尝试一些时间它创建问题,这是我的配置,也许它可以帮助您
https://stackoverflow.com/questions/65072794
复制相似问题