laravel-websockets
laravel-websockets copied to clipboard
Action WebSocketStatisticsEntriesController@store not defined
Hello !
In advance, I'm just starting with PHP websocket, I'm still a noob.
So I have a project where I just have the following files:
BeginTrackProduct.php :
<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class BeginTrackProduct implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the channels the event should broadcast on.
*
* @return Channel|array
*/
public function broadcastOn(): Channel|array
{
return new Channel('product-tracking');
}
}
BeginTrackProductListener.php :
<?php
namespace App\Listeners;
use App\Events\BeginTrackProduct;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
class BeginTrackProductListener
{
/**
* Create the event listener.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param BeginTrackProduct $event
* @return void
*/
public function handle(BeginTrackProduct $event)
{
//
}
}
Config available here : https://gist.github.com/SirMishaa/8932a2f2e3700218fb8f1449a4723308
So all work good, I have the event in the debug console of Pusher.com, but after few seconds, websocket server stopping with an error :
Starting the WebSocket server on port 6001...
InvalidArgumentException
Action BeyondCode\LaravelWebSockets\Statistics\Http\Controllers\WebSocketStatisticsEntriesController@store not defined.
at vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php:483
479▕ */
480▕ public function action($action, $parameters = [], $absolute = true)
481▕ {
482▕ if (is_null($route = $this->routes->getByAction($action = $this->formatAction($action)))) {
➜ 483▕ throw new InvalidArgumentException("Action {$action} not defined.");
484▕ }
485▕
486▕ return $this->toRoute($route, $parameters, $absolute);
487▕ }
+22 vendor frames
23 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
What's happening?
I'm using "pusher/pusher-php-server": "5.0.3",
, with "laravel/framework": "^8.5"
maybe should I upgrade?
Thanks in advance