我有我的推送键集,并在Laravel 5.3中初始化。当我在我的本地环境中测试它时,它可以工作。当我尝试运行我们的生产环境完全相同的代码,我得到这个错误:Laravel广播授权路由只是返回“true”
Pusher : Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":null,"message":"Auth info required to subscribe to private-App.User.16"}}}
我已经证实了推关键是我的地方和生产都相同。
的WS上都初始化环境相同:
wss://ws.pusherapp.com/app/264P9d412196d622od64d?protocol=7&client=js&version=4.1.0&flash=false
唯一的区别,我可以看到,就是当我们的生产服务器联系Laravel“广播/ AUTH”的路线,它只是接收true
在应对机构。
当我的本地联系人 “广播/ AUTH” 它得到这个在响应:
{auth: "22459d41299d6228d64d:df5d393fe37df0k3832fa5556098307f145d7e483c07974d8e7b2609200483f8"}
在我的BroadcastServiceProvider.php
:
public function boot()
{
Broadcast::routes();
// Authenticate the user's personal channel.
Broadcast::channel('App.User.*', function (User $user, $user_id) {
return (int)$user->id === (int)$user_id;
});
}
什么可能导致broadcast/auth
路线简单地返回,而不是true
预期的认证?
不应该在'route/channels.php'上吗? [链接](https://github.com/laravel/laravel/blob/master/app/Providers/BroadcastServiceProvider.php) –
@AntoniosTsimourtos是Laravel 5.3之后的版本。 – eComEvo
这是基本的,但我想它值得问:你使用'composer.lock'来确保你在两个envs中都有相同的代价? –