laravel / reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.
https://reverb.laravel.com
MIT License
1.02k stars 71 forks source link

Message broadcast happens for non existent app id #142

Closed sfolador closed 4 months ago

sfolador commented 4 months ago

Reverb Version

v1.0.0-beta6

Laravel Version

11.3.1

PHP Version

8.2.13

Description

If an event is broadcast to a non existend app id an exception is correctly raised ( Illuminate\Broadcasting\BroadcastException Pusher error: No matching application for ID) but the event is broadcast anyway and connected clients will receive that event even if the clients are connected to another app ID.

I do not know if this is an expected behaviour or not.

The reverb server is hosted on Forge.

Laravel version is 11.3.1 but it was updated from 10, i do not know if this could be an important information for you.

Steps To Reproduce

<?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 OrderShipmentStatusUpdated implements ShouldBroadcast
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public function __construct(public $name)
    {
    }

    public function broadcastOn(): array
    {
        return [
            new Channel('orders'),
        ];
    }

}
<script>
window.onload = function(){
    console.log("connect");
    Echo.channel('orders')
        .listen('OrderShipmentStatusUpdated', (e) => {
            // ...

            console.log(e);
            console.log("asdad");
     });
}
</script>

You can see the whole flow in the video below.

https://github.com/laravel/reverb/assets/36632/5a2932e9-58f3-432b-9e7a-3100a2a8a92e

Tayyeb-max commented 1 week ago

There is no app id secret id in laravel reverb