Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

[2.x] Error when starting websocket with custom handler. #731

@rodrigoross

Description

@rodrigoross

Hello.

I'm trying to create a custom handler, my laravel-websocket current version is 2.0.0-beta.33.

app\MyCustomWebSocketHandler.php

namespace App;

use BeyondCode\LaravelWebSockets\Server\WebSocketHandler;
use Exception;
use Illuminate\Support\Facades\Log;
use Ratchet\ConnectionInterface;
use Ratchet\RFC6455\Messaging\MessageInterface;
use Ratchet\WebSocket\MessageComponentInterface;

class MyCustomWebSocketHandler extends WebSocketHandler
{
    public function onOpen(ConnectionInterface $connection)
    {
        Log::info($connection->httpRequest);
    }
}

In my routes/web.php I added the following

use App\MyCustomWebSocketHandler;
use BeyondCode\LaravelWebSockets\Facades\WebSocketRouter;

WebSocketRouter::get('/test', MyCustomWebSocketHandler::class);

But when I try to restart the websocket server, I get the following error:

image

Searching in the error in the issues page I found the #531, however it says that was fixed at beta.21, So I'd like to know if there is another workaround, or there is a step that I missed.

I even changed the WebSocketRouter::get('/test', MyCustomWebSocketHandler::class); to boot() in AppServiceProvider.php, but to no avail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions