qruto / laravel-wave Goto Github PK
View Code? Open in Web Editor NEWPainless Laravel Broadcasting with SSE
License: MIT License
Painless Laravel Broadcasting with SSE
License: MIT License
Error Exception after Published 'channels' route file.
copy(/Users/project/mylaravelproject/vendor/qruto/laravel-wave/src/Console/Commands/../../../vendor/laravel/framework/src/Illuminate/Foundation/Console/stubs/broadcasting-routes.stub): Failed to open stream: No such file or directory
composer require qruto/laravel-wave
php artisan install:broadcasting
0.9
8.2.14
11.2.0
macOS
I suggest in BroadcastingInstallCommand.php do not using relative paths to copy stubs. instead using basepath to the stub file.
Thank you.
I'm trying to broadcast to a presence channel and I'm not seeing anything sent/received.
I have a model set up to broadcast on changes:
public function broadcastOn(string $event): array
{
return match ($event) {
'created' => [new PresenceChannel('chat.'.$this->receiver_id)],
default => [],
};
}
I have auth set up in channels.php
, which seems to work (no 403 errors in console):
Broadcast::channel('chat.{user}', function (User $user, User $receiver) {
if ($user->id === $receiver->id) {
return ['id' => $user->id, 'name' => $user->name];
}
return false;
});
I added this to my app.js
:
Echo.join('chat.3')
.here(() => {
console.log('here');
})
.joining(() => {
console.log('joining');
})
.leaving(() => {
console.log('leaving');
})
.listen('MessageCreated', (e) => {
console.log('listening')
});
And I don't see the listening
in my console.log, only here
.
0.7.1
8.2.8
10.19
macOS
I will see if I can figure out a failing test for this, but I did notice there were no presence
tests.
When using frontend in a url or port different of the backend, the connection is not stablished and i cannot configure custom url or port
Using frontend framework like NEXT.JS
0.7.1
8.2.0
9.0
I created a repository to present the solution to the problem: https://github.com/victorcesae/feature-laravel-wave-client
No response
Accessing https://wave.qruto.dev/ gives an error as its SSL certificate expired on Feb 7th, 2024
Access https://wave.qruto.dev/ from a browser
0.8.1
8.2.15
10.43.0
Linux
I wasn't sure how to contact you about this, but thought you'd like to know. Thanks for this package, works like a charm.
Usually, Laravel throws an error when the PHP Redis extension is disabled. It will show you the following message:
Please make sure the PHP Redis extension is installed and enabled.
Setting the BROADCAST_DRIVER
to redis
and having the PHP Redis extension disabled will not output this message. I did a fresh install of my PC and forgot to enable the PHP Redis extension, leading to running around for a while when no errors were getting thrown.
I use predis and there seems to be a difference with the interface.
[2024-03-13 13:22:45] production.ERROR: ERR wrong number of arguments for 'xdel' command {"exception":"[object] (Predis\\Response\\ServerException(code: 0): ERR wrong number of arguments for 'xdel' command at /path/vendor/predis/predis/src/Client.php:416)
[stacktrace]
#0 /path/vendor/predis/predis/src/Client.php(385): Predis\\Client->onErrorResponse()
#1 /path/vendor/predis/predis/src/Client.php(335): Predis\\Client->executeCommand()
#2 /path/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(116): Predis\\Client->__call()
#3 /path/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(216): Illuminate\\Redis\\Connections\\Connection->command()
#4 /path/vendor/qruto/laravel-wave/src/Storage/BroadcastEventHistoryRedisStream.php(65): Illuminate\\Redis\\Connections\\Connection->__call()
#5 /path/vendor/qruto/laravel-wave/src/Storage/BroadcastEventHistoryRedisStream.php(46): Qruto\\Wave\\Storage\\BroadcastEventHistoryRedisStream->removeOldEvents()
#6 /path/vendor/qruto/laravel-wave/src/BroadcastManagerExtended.php(30): Qruto\\Wave\\Storage\\BroadcastEventHistoryRedisStream->pushEvent()
#7 /path/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(84): Illuminate\\Broadcasting\\Broadcasters\\RedisBroadcaster@anonymous->broadcast()
#8 /path/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Broadcasting\\BroadcastEvent->handle()
#9 /path/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#10 /path/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#11 /path/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#12 /path/vendor/laravel/framework/src/Illuminate/Container/Container.php(661): Illuminate\\Container\\BoundMethod::call()
#13 /path/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#14 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#15 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#16 /path/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#17 /path/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Bus\\Dispatcher->dispatchNow()
#18 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(141): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#19 /path/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#20 /path/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\\Pipeline\\Pipeline->then()
#21 /path/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#22 /path/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\\Queue\\CallQueuedHandler->call()
#23 /path/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(425): Illuminate\\Queue\\Jobs\\Job->fire()
#24 /path/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(375): Illuminate\\Queue\\Worker->process()
#25 /path/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(326): Illuminate\\Queue\\Worker->runJob()
#26 /path/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(147): Illuminate\\Queue\\Worker->runNextJob()
#27 /path/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(130): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#28 /path/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#29 /path/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#30 /path/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#31 /path/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#32 /path/vendor/laravel/framework/src/Illuminate/Container/Container.php(661): Illuminate\\Container\\BoundMethod::call()
#33 /path/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call()
#34 /path/vendor/symfony/console/Command/Command.php(312): Illuminate\\Console\\Command->execute()
#35 /path/vendor/laravel/framework/src/Illuminate/Console/Command.php(152): Symfony\\Component\\Console\\Command\\Command->run()
#36 /path/vendor/symfony/console/Application.php(1022): Illuminate\\Console\\Command->run()
#37 /path/vendor/symfony/console/Application.php(314): Symfony\\Component\\Console\\Application->doRunCommand()
#38 /path/vendor/symfony/console/Application.php(168): Symfony\\Component\\Console\\Application->doRun()
#39 /path/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\\Component\\Console\\Application->run()
#40 /path/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\\Console\\Application->run()
#41 /path/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()
#42 {main}
"}
and
production.ERROR: Array to string conversion {"userId":1,"exception":"[object] (ErrorException(code: 0): Array to string conversion at /path/vendor/predis/predis/src/Connection/StreamConnection.php:368)
[stacktrace]
#0 /path/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(270): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /path/vendor/predis/predis/src/Connection/StreamConnection.php(368): strval()
#3 /path/vendor/predis/predis/src/Connection/AbstractConnection.php(122): Predis\\Connection\\StreamConnection->writeRequest()
#4 /path/vendor/predis/predis/src/Client.php(381): Predis\\Connection\\AbstractConnection->executeCommand()
#5 /path/vendor/predis/predis/src/Client.php(335): Predis\\Client->executeCommand()
#6 /path/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(116): Predis\\Client->__call()
#7 /path/vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php(216): Illuminate\\Redis\\Connections\\Connection->command()
#8 /path/vendor/qruto/laravel-wave/src/Storage/BroadcastEventHistoryRedisStream.php(54): Illuminate\\Redis\\Connections\\Connection->__call()
#9 /path/vendor/qruto/laravel-wave/src/Sse/ServerSentEventStream.php(70): Qruto\\Wave\\Storage\\BroadcastEventHistoryRedisStream->pushEvent()
#10 /path/vendor/laravel/framework/src/Illuminate/Support/helpers.php(306): Qruto\\Wave\\Sse\\ServerSentEventStream->Qruto\\Wave\\Sse\\{closure}()
#11 /path/vendor/qruto/laravel-wave/src/Sse/ServerSentEventStream.php(67): tap()
#12 /path/vendor/symfony/http-foundation/StreamedResponse.php(92): Qruto\\Wave\\Sse\\ServerSentEventStream->Qruto\\Wave\\Sse\\{closure}()
#13 /path/vendor/symfony/http-foundation/Response.php(377): Symfony\\Component\\HttpFoundation\\StreamedResponse->sendContent()
#14 /path/public/index.php(67): Symfony\\Component\\HttpFoundation\\Response->send()
#15 /path/server.php(26): require_once('...')
#16 {main}
The order of xadd is not the same for phpredis and predis:
phpredis xadd:
https://github.com/phpredis/phpredis?tab=readme-ov-file#xadd
predis xadd:
https://github.com/predis/predis/blob/45b18eb2e06c7e1b3aaf98eb99e247ae0eb3ec0d/src/ClientInterface.php#L278
Possible fix for:
if($this->db instanceof PhpRedisConnection){
$id = $this->db->xAdd('broadcasted_events', '*', $eventData);
}else{
$id = $this->db->xAdd('broadcasted_events', $eventData, '*');
}
And xDel does not work with an empty array.
Possible fix for: https://github.com/qruto/laravel-wave/blob/d304c96b4a9326654fd5c6e42c7ce6243f147e52/src/Storage/BroadcastEventHistoryRedisStream.php#L65C9-L65C72
if(count($oldEvents) === 0){
return;
}
$this->db->xDel('broadcasted_events', \array_keys($oldEvents));
0.8.1
8.2.10
v9.52.7
Linux
No response
I use api in laravel!! I add only allowed urls in config/cors.php (allowed_origins)
localhost:8080/wave not use 'Access-Control-Allow-Origin'
0.7.1
8.2.0
10.16.1
Linux
No response
same route name error
when use optimize
when use
php artisan optimize
it shows
LogicException
Unable to prepare route [wave/presence-channel-users] for serialization. Another route has already been assigned name [wave.presence-channel-users].
at vendor/laravel/framework/src/Illuminate/Routing/AbstractRouteCollection.php:247
243▕ $route->name($this->generateRouteName());
244▕
245▕ $this->add($route);
246▕ } elseif (! is_null($symfonyRoutes->get($name))) {
➜ 247▕ throw new LogicException("Unable to prepare route [{$route->uri}] for serialization. Another route has already been assigned name [{$name}].");
248▕ }
249▕
250▕ $symfonyRoutes->add($route->getName(), $route->toSymfonyRoute());
251▕
+34 vendor frames
35 artisan:35
Illuminate\Foundation\Console\Kernel::handle()
"qruto/laravel-wave": "^0.6.0",
8.2.1
10.7.1
Windows
No response
I'm trying to connect laravel octane with laravel wave! however, it is repeating the GET requests for /wave in the console!
I'm using laradock + laravel octane + swoole!
pecl -q install swoole-4.8.12
roadrunner the same thing happens too!
install laradock + swoole + laravel wave
0.8.0
8.2.0
10.28
Linux
Your package is among a lot of packages that got affected by the new module
type in packages.json
:
https://github.com/laravel/laravel/blob/84991f23011dfde4bc3ae3db04343c3afb3bc122/package.json#LL3C22-L3C22
Laravel-Wave now throws this exception:
Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/laravel-wave.js?v=f42660d9' does not provide an export named 'default' (at echo.js:9:8)
Just install it in a new Laravel project, I guess?!
^0.7.1
8.1.7
10.13.5
Linux
I'm using the TALL stack. (blade
preset with Laravel Breeze)
Running SSE normally (redis worker running, Echo on front end).
See a ton of these in my log: https://flareapp.io/share/87newjDP
Run my app.
Sorry don't know the repro issue yet.
0.7.1
8.2.8
10.18.0
macOS
No response
Cannot connect with wave. error with this net::ERR_HTTP2_PROTOCOL_ERROR 200 on HTTP/2 and net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK) on HTTP/1.1 on console
Installation process shown on github repo and see in console
0.7.1
8.2.8
10.15.0
macOS, Linux
No response
In previous versions of laravel-wave when connecting to a private channel a request is made to /broadcasting/auth
and a body is sent:
socket_id: xxxxxx.xxxxxx
channel_name: private-user.1
in the new version of laravel wave it is not possible to connect to a private channel! probably because it doesn't send a request to /broadcasting/auth
window.EchoWave = new Echo({
broadcaster: WaveConnector,
debug: true,
endpoint: '/wave',
authEndpoint: '/broadcasting/auth',
})
when connecting to a private channel it automatically makes a request for /broadcasting/auth! what is not happening at the moment! this way it is not possible to receive events in private channels
window.Echo.private('user.1').listen('RealTimeNotification', e => {
console.log('Echo user 1 Private ', e.message)
})
window.Echo.private('user.2').listen('RealTimeNotification', e => {
console.log('Echo user 2 Private ', e.message)
})
window.Echo.channel('events').listen('RealTimeNotification', e => {
console.log('Echo ', e.message)
})
0.7.0
8.2.0
10.10
Linux
No response
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.