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.

Unable to register custom WebSocket Handler #21

@larssonwassen

Description

@larssonwassen

Hi,
First of, thanks for your great work!

When registrering the route for a custom WebSocket handler using:
WebSocketsRouter::webSocket('/socket', \App\WS\Handlers\Handler::class)
in reoutes/web.php laravel is unable to boot with the following exception:
Target [Symfony\Component\Console\Output\OutputInterface] is not instantiable while building [BeyondCode\LaravelWebSockets\Server\Logger\WebsocketsLogger].

My workaround for the issue is to call:

use Symfony\Component\Console\Output\NullOutput;
app()->singleton(WebsocketsLogger::class, function () {
    return (new WebsocketsLogger(new NullOutput()))->enable(false);
});

before the route registering. I guess that defering the route registering to after the the server has setup the loggers would be a solution?

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