【问题标题】:Laravel WebSockets. Issue with App key. How it fix?Laravel 网络套接字。应用密钥问题。怎么修?
【发布时间】:2023-01-24 14:44:37
【问题描述】:

我可以启动 websocket

php artisan websockets:serve

但是当我尝试打开我的网站页面时,它说

New connection opened for app key websocketkey.
Exception `BeyondCode\LaravelWebSockets\WebSockets\Exceptions\UnknownAppKey` thrown: `Could not find app key `websocketkey`.`
Unknown app id: exception `BeyondCode\LaravelWebSockets\WebSockets\Exceptions\UnknownAppKey` thrown: `Could not find app key `websocketkey`.`.
Connection id  sending message {"event":"pusher:error","data":{"message":"Could not find app key `websocketkey`.","code":4001}}
Connection id  closed.
Exception `ErrorException` thrown: `Undefined property: Ratchet\Server\IoConnection::$app`

在 config/websockets.php 中,我从 env 获得了应用程序密钥

'apps' => [
    [
        'id' => env('PUSHER_APP_ID'),
        'name' => env('APP_NAME'),
        'key' => env('PUSHER_APP_KEY'),
        'secret' => env('PUSHER_APP_SECRET'),
        'enable_client_messages' => true,
        'enable_statistics' => true,
    ],
],

我不明白从哪里得到 websocketkey。因为 env 中没有这样的值。 我尝试php artisan config:clear,但没有帮助。 请分享谁知道如何解决这个问题以及为什么会发生。

【问题讨论】:

    标签: php laravel websocket real-time-updates


    【解决方案1】:

    重新启动 websocket 对我有用,而 php artisan config:clear 没有。

    【讨论】:

    猜你喜欢
    • 2011-03-06
    • 2016-03-30
    • 2017-09-21
    • 2019-10-11
    • 2013-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多