Laravel-websockets: Custom WebSocket Handlers - Class 'WebSocketsRouter' not found

Created on 8 Jan 2020  ยท  10Comments  ยท  Source: beyondcode/laravel-websockets

Referring from :-
https://docs.beyondco.de/laravel-websockets/1.0/advanced-usage/custom-websocket-handlers.html

After adding
WebSocketsRouter::webSocket('/my-websocket', \App\MyCustomWebSocketHandler::class);

Getting error
Custom WebSocket Handlers - Class 'WebSocketsRouter' not found

Also referred to #21

But causing all other socket somehow (like redirect to MyCustomWebSocketHandler)

bug question

Most helpful comment

Yeah I ran into this today. I scoped the class name as a quick fix. Wondering if there's a step missing from the documentation? ๐Ÿค”

<?php
use BeyondCode\LaravelWebSockets\Facades\WebSocketsRouter;

WebSocketsRouter::webSocket('/my-websocket', \App\MyCustomWebSocketHandler::class);

All 10 comments

Yeah I ran into this today. I scoped the class name as a quick fix. Wondering if there's a step missing from the documentation? ๐Ÿค”

<?php
use BeyondCode\LaravelWebSockets\Facades\WebSocketsRouter;

WebSocketsRouter::webSocket('/my-websocket', \App\MyCustomWebSocketHandler::class);

@Sh3nl0ng Getting error -

Target [Symfony\Component\Console\Output\OutputInterface] is not instantiable while building [BeyondCode\LaravelWebSockets\Server\Logger\WebsocketsLogger].

Any updates?

@Sh3nl0ng Getting error -

Target [Symfony\Component\Console\Output\OutputInterface] is not instantiable while building [BeyondCode\LaravelWebSockets\Server\Logger\WebsocketsLogger].

Same issue in 2.0.0-beta.26

Does this seem like it's not run from the console?

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

   Illuminate\Contracts\Container\BindingResolutionException

  Target [Symfony\Component\Console\Output\OutputInterface] is not instantiable while building [BeyondCode\LaravelWebSockets\Server\Loggers\WebSocketsLogger].

  at D:\code\laravel-projects\laravel-vuetify\vendor\laravel\framework\src\Illuminate\Container\Container.php:1017
    1013โ–•         } else {
    1014โ–•             $message = "Target [$concrete] is not instantiable.";
    1015โ–•         }
    1016โ–•
  โžœ 1017โ–•         throw new BindingResolutionException($message);
    1018โ–•     }
    1019โ–•
    1020โ–•     /**
    1021โ–•      * Throw an exception for an unresolvable primitive.

  1   D:\code\laravel-projects\laravel-vuetify\vendor\laravel\framework\src\Illuminate\Container\Container.php:818
      Illuminate\Container\Container::notInstantiable("Symfony\Component\Console\Output\OutputInterface")

  2   D:\code\laravel-projects\laravel-vuetify\vendor\laravel\framework\src\Illuminate\Container\Container.php:691
      Illuminate\Container\Container::build("Symfony\Component\Console\Output\OutputInterface")
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

composer dump-autoload caused this error when defined custom websocket handler

Same issue in 2.0.0-beta.32

Actually there is no WebSocketsRouter Facade in 2.0 , only one without the 's' in BeyondCode\LaravelWebSockets\Facades so which is the correct one?

<?php
use BeyondCode\LaravelWebSockets\Facades\WebSocketsRouter;

WebSocketsRouter::webSocket('/my-websocket', \App\MyCustomWebSocketHandler::class);
Was this page helpful?
0 / 5 - 0 ratings

Related issues

myckhel picture myckhel  ยท  3Comments

vesper8 picture vesper8  ยท  3Comments

sanjarani picture sanjarani  ยท  5Comments

vesper8 picture vesper8  ยท  3Comments

darklight9811 picture darklight9811  ยท  4Comments