Grut
Grut

Reputation: 1

Laravel WebSockets. Issue with App key. How it fix?

I can start websocket on

php artisan websockets:serve

But when i try to open my site page it says that

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`

In config/websockets.php i got app key from 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,
    ],
],

I don't understand where getting websocketkey from. Because there are no such values in env. I try php artisan config:clear and it didn't help. Please share who knows how to solve this and why it happens at all.

Upvotes: 0

Views: 2570

Answers (3)

PHANTOM-X
PHANTOM-X

Reputation: 586

You can use tools like websocketking or postman, I immediately fixed the issue after using websocketking

turns out it was an REVERB_APP_KEY issue

Error message was on Laravel 11:

4001 Application does not exist

Upvotes: 0

gurminder singh
gurminder singh

Reputation: 1

add this in .env in quotes

PUSHER_APP_ID="anything"
PUSHER_APP_KEY="anything_key"
PUSHER_APP_SECRET="anything_secret"

Upvotes: 0

fredrick rogath
fredrick rogath

Reputation: 41

Restarting the websocket worked for me, while php artisan config:clear did not.

Upvotes: 0

Related Questions