F
Filament4mo ago
ericmp

How to configure reverb with filament?

i want to be able to chat in admin panel. i installed laravel broadcasting and reverb I, following this tutorial https://laraveldaily.com/post/configure-laravel-reverb-filament-broadcasting, did: php artisan vendor:publish --tag=filament-config but now i have this:
'broadcasting' => [

// 'echo' => [
// 'broadcaster' => 'pusher',
// 'key' => env('VITE_PUSHER_APP_KEY'),
// 'cluster' => env('VITE_PUSHER_APP_CLUSTER'),
// 'wsHost' => env('VITE_PUSHER_HOST'),
// 'wsPort' => env('VITE_PUSHER_PORT'),
// 'wssPort' => env('VITE_PUSHER_PORT'),
// 'authEndpoint' => '/broadcasting/auth',
// 'disableStats' => true,
// 'encrypted' => true,
// 'forceTLS' => true,
// ],

],
'broadcasting' => [

// 'echo' => [
// 'broadcaster' => 'pusher',
// 'key' => env('VITE_PUSHER_APP_KEY'),
// 'cluster' => env('VITE_PUSHER_APP_CLUSTER'),
// 'wsHost' => env('VITE_PUSHER_HOST'),
// 'wsPort' => env('VITE_PUSHER_PORT'),
// 'wssPort' => env('VITE_PUSHER_PORT'),
// 'authEndpoint' => '/broadcasting/auth',
// 'disableStats' => true,
// 'encrypted' => true,
// 'forceTLS' => true,
// ],

],
but i dont use pusher, but reverb idk how to make it work, i tried:
'broadcasting' => [

'echo' => [
'broadcaster' => 'reverb',
'key' => env('VITE_REVERB_APP_KEY'),
'cluster' => env('VITE_REVERB_APP_CLUSTER'),
'wsHost' => env('VITE_REVERB_HOST'),
'wsPort' => env('VITE_REVERB_PORT'),
'wssPort' => env('VITE_REVERB_PORT'),
'authEndpoint' => '/broadcasting/auth',
'disableStats' => true,
'encrypted' => true,
'forceTLS' => true,
],

],
'broadcasting' => [

'echo' => [
'broadcaster' => 'reverb',
'key' => env('VITE_REVERB_APP_KEY'),
'cluster' => env('VITE_REVERB_APP_CLUSTER'),
'wsHost' => env('VITE_REVERB_HOST'),
'wsPort' => env('VITE_REVERB_PORT'),
'wssPort' => env('VITE_REVERB_PORT'),
'authEndpoint' => '/broadcasting/auth',
'disableStats' => true,
'encrypted' => true,
'forceTLS' => true,
],

],
then i do npm run build but i always get in console dev tools:
data
:
"{\"code\":4001,\"message\":\"Application does not exist\"}"
event
:
"pusher:error"
data
:
"{\"code\":4001,\"message\":\"Application does not exist\"}"
event
:
"pusher:error"
79 Replies
ericmp
ericmpOP4mo ago
how can i fix it? i cannot find any example on internet seems like is trying to connect with pusher, online, no? im using reverb in the server locally, i dont want it to connect to pusher idk what to put in the cluster, since reverb doesnt have cluster, or it does? .env: BROADCAST_DRIVER=reverb bump
Rolland
Rolland4mo ago
have you figure out how to make reverb work with filament?
ModestasV
ModestasV4mo ago
@ericmp @Rolland please ping me if you have issues with this still. I'm the one that wrote that article 🙂
ericmp
ericmpOP4mo ago
please read my message, i already sent this link not yet i still do ^^
ModestasV
ModestasV4mo ago
Can you show your .env configuration and filament.php section on boardcasting? (.env is needed around reverb/vite)
ericmp
ericmpOP4mo ago
im in another pc and i didnt commit :v i can tell u my filament.php looks like this now:
'broadcasting' => [

'echo' => [
'broadcaster' => 'reverb',
'key' => env('VITE_REVERB_APP_KEY'),
'cluster' => env('VITE_REVERB_APP_CLUSTER'),
'wsHost' => env('VITE_REVERB_HOST'),
'wsPort' => env('VITE_REVERB_PORT'),
'wssPort' => env('VITE_REVERB_PORT'),
'authEndpoint' => '/broadcasting/auth',
'disableStats' => true,
'encrypted' => true,
'forceTLS' => true,
],

],
'broadcasting' => [

'echo' => [
'broadcaster' => 'reverb',
'key' => env('VITE_REVERB_APP_KEY'),
'cluster' => env('VITE_REVERB_APP_CLUSTER'),
'wsHost' => env('VITE_REVERB_HOST'),
'wsPort' => env('VITE_REVERB_PORT'),
'wssPort' => env('VITE_REVERB_PORT'),
'authEndpoint' => '/broadcasting/auth',
'disableStats' => true,
'encrypted' => true,
'forceTLS' => true,
],

],
and in the .env i have the keys that reverb sets automatically, i just changed the host to my actual host (subdomain) example.mydomain.com and the port to 443 @ModestasV should i provide more detail? the subdomain has ssl configured correctly in the post it says the broadcaster should be pusher, and all the env keys refer to pusher, is that ok or we have to change it to reverb instead? 'broadcaster' => 'pusher', to 'broadcaster' => 'reverb', 'wsHost' => env('VITE_PUSHER_HOST'), to 'wsHost' => env('VITE_REVERB_HOST'), etc
ModestasV
ModestasV4mo ago
Set forceTLS to false 🙂 Here's a sample env (ignore message that was there before)
REVERB_APP_ID=872729
REVERB_APP_KEY=xvka9nt9izfvfitrneew
REVERB_APP_SECRET=svpfxlkv7uvhxkpqwbpd
REVERB_HOST="localhost"
REVERB_PORT=8080
REVERB_SCHEME=http

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"
REVERB_APP_ID=872729
REVERB_APP_KEY=xvka9nt9izfvfitrneew
REVERB_APP_SECRET=svpfxlkv7uvhxkpqwbpd
REVERB_HOST="localhost"
REVERB_PORT=8080
REVERB_SCHEME=http

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"
ericmp
ericmpOP4mo ago
what about the cluster? 'cluster' => env('VITE_PUSHER_APP_CLUSTER'), - i can leave it empty? reverb doesnt have cluster, no? noted. asap ill test it and let u know if i succeeded okay yeah i have it like this but in the host, my host and port 443 and scheme https
ModestasV
ModestasV4mo ago
But why? 🙂
ericmp
ericmpOP4mo ago
why what? what point in specifically?
ModestasV
ModestasV4mo ago
Reverb port !== https port
ericmp
ericmpOP4mo ago
no is the same cuz then i reverse proxy
ModestasV
ModestasV4mo ago
Well.. you are complicating your setup 😄 In that case, I can't help much if that's the breaking thing 🙂
ericmp
ericmpOP4mo ago
oh, so is not needed? i mean, in terms of nginx i dont have to configure anything to make reverb work?
ModestasV
ModestasV4mo ago
ps. I would first make it work with defaults as much as possible, then see what doesn't work
ModestasV
ModestasV4mo ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
ModestasV
ModestasV4mo ago
@ericmp you should follow the official docs for prod deployment 😉
ericmp
ericmpOP4mo ago
i am doing it: https://laravel.com/docs/11.x/reverb#web-server no? let me check yeah i have it like the docs
ModestasV
ModestasV4mo ago
But wait, is the reverb not working on prod only?
ericmp
ericmpOP4mo ago
the reverb works on prod, it doesnt work inside the admin panel i only have prod, i dont have any other environtments is a server to test, i code directly there. i only access it
ModestasV
ModestasV4mo ago
Oh... 🙂
ericmp
ericmpOP4mo ago
so how u configured reverb. on prod? id like to know what u did (:
ModestasV
ModestasV4mo ago
To be fair, followed the official docs 😄
ericmp
ericmpOP4mo ago
and inside admin panel, just works?
ModestasV
ModestasV4mo ago
But I made sure that everything works locally first Yeah, it worked just fine with the panel 🙂
ericmp
ericmpOP4mo ago
and in ur env u didnt have any pusher key, right? only reverb keys what about the cluster key? VITE_PUSHER_APP_CLUSTER
ModestasV
ModestasV4mo ago
I sent the .env practically as is (from local, but the same with rotated keys in prod) 😄 skip it, there is no clusters Filament generates the configuration based on what's filled
ericmp
ericmpOP4mo ago
one thing i dont understand is the error i get:
data
:
"{\"code\":4001,\"message\":\"Application does not exist\"}"
event
:
"pusher:error"
data
:
"{\"code\":4001,\"message\":\"Application does not exist\"}"
event
:
"pusher:error"
why it says pusher? im using reverb, not pusher
ModestasV
ModestasV4mo ago
where do you get this error?
ericmp
ericmpOP4mo ago
in a filament admin page where i try to connect to a defined channel
ModestasV
ModestasV4mo ago
Can you search your html of the site to see what configuration it generated. Specifically search for: window.Echo = new window.EchoFactory(
ericmp
ericmpOP4mo ago
u mean in the build echo js public file?
ModestasV
ModestasV4mo ago
ye but it shouldn't be in a js file, rather in your main html Simply visit page, inspect and search for that
ericmp
ericmpOP4mo ago
ah okay, u mean, go to the admin panel chat page - browser open dev tools and search for that?
ModestasV
ModestasV4mo ago
yes but not just chat page, to be fair - any page. As soon as filament loads it should connect
ericmp
ericmpOP4mo ago
okay, ill test it and ping u, now i can as i said cuz im not at the machine where i can access the server. ill try this and i share u the results and also try Set forceTLS to false so far thanks bro, apreciate the feedback
Rolland
Rolland4mo ago
do i need to run "npm install --save-dev laravel-echo pusher-js"? I am on L10.
ericmp
ericmpOP4mo ago
afaik u dont need to, since if u run php artisan install:broadcasting it already does it
Rolland
Rolland4mo ago
but L10 does not have that command. My thought was Filament already have this installed.
ericmp
ericmpOP4mo ago
then ye i think u r right, but maybe u can update to v11, there is not a lot of breaking changes (https://laravel.com/docs/11.x/upgrade) and u can keep the file strucure of a laravel10 project using laravel11 or u can try to search what php artisan install:broadcasting does exactly on laravel11 and try to do it step by step on your laravel10 project
Rolland
Rolland4mo ago
I see, but for now I wanted to make it working on L10. anyone recognise this type of error?
{event: "pusher:error", data: {code: 4005, message: "Path not found"}}
data
:
{code: 4005, message: "Path not found"}
code
:
4005
message
:
"Path not found"
event
:
"pusher:error"
{event: "pusher:error", data: {code: 4005, message: "Path not found"}}
data
:
{code: 4005, message: "Path not found"}
code
:
4005
message
:
"Path not found"
event
:
"pusher:error"
ericmp
ericmpOP4mo ago
share ur .env keys related to reverb
Rolland
Rolland4mo ago
my bad, I just forgot to edit the .env in filament config. btw in my console i got this:
failed: WebSocket is closed before the connection is established.
failed: WebSocket is closed before the connection is established.
is it because the tools that I'm using incompatible? Im using Laragon. 😄
ModestasV
ModestasV4mo ago
Check network tab for wss connections and see what error it has
Rolland
Rolland4mo ago
this?
No description
ModestasV
ModestasV4mo ago
Okay, can you run reverb with --debug flag? see if it even makes a connection
Rolland
Rolland4mo ago
my env
REVERB_HOST="procurement.dev"
REVERB_PORT=8080
REVERB_SCHEME=http
REVERB_HOST="procurement.dev"
REVERB_PORT=8080
REVERB_SCHEME=http
Rolland
Rolland4mo ago
No description
Rolland
Rolland4mo ago
if it help, I have ssl enabled.
ModestasV
ModestasV4mo ago
So that's your problem then you need the schema to be https 🙂
Rolland
Rolland4mo ago
i set the REVERB_SCHEME=https and restart the reverb. I still got the same problem.
No description
Rolland
Rolland4mo ago
WebSocket is closed before the connection is established.
WebSocket is closed before the connection is established.
ModestasV
ModestasV4mo ago
show your broadcasting config section 🙂
ModestasV
ModestasV4mo ago
In filament, not this file 🙂 This file does nothing to filament config filament.php configuration file
Rolland
Rolland4mo ago
my bad.
'broadcasting' => [

'echo' => [
'broadcaster' => 'reverb',
'key' => env('VITE_REVERB_APP_KEY'),
'cluster' => env('VITE_REVERB_APP_CLUSTER'),
'wsHost' => env('VITE_REVERB_HOST'),
'wsPort' => env('VITE_REVERB_PORT'),
'wssPort' => env('VITE_REVERB_PORT'),
'authEndpoint' => '/broadcasting/auth',
'disableStats' => true,
'encrypted' => true,
'forceTLS' => false,
],

],
'broadcasting' => [

'echo' => [
'broadcaster' => 'reverb',
'key' => env('VITE_REVERB_APP_KEY'),
'cluster' => env('VITE_REVERB_APP_CLUSTER'),
'wsHost' => env('VITE_REVERB_HOST'),
'wsPort' => env('VITE_REVERB_PORT'),
'wssPort' => env('VITE_REVERB_PORT'),
'authEndpoint' => '/broadcasting/auth',
'disableStats' => true,
'encrypted' => true,
'forceTLS' => false,
],

],
ModestasV
ModestasV4mo ago
Hmm, did you register broadcasting routes correctly? Can you check the list?
Rolland
Rolland4mo ago
list?
ModestasV
ModestasV4mo ago
php artisan route:list
Rolland
Rolland4mo ago
GET|POST|HEAD broadcasting/auth ................................................................. Illuminate\Broadcasting › BroadcastController@authenticate
GET|POST|HEAD broadcasting/auth ................................................................. Illuminate\Broadcasting › BroadcastController@authenticate
is it this one?
ModestasV
ModestasV4mo ago
yep, seems to be okay... hmm
Rolland
Rolland4mo ago
BROADCAST_DRIVER=reverb
# CACHE_DRIVER=file
CACHE_DRIVER=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
# SESSION_DRIVER=file
SESSION_DRIVER=redis
SESSION_LIFETIME=120
BROADCAST_DRIVER=reverb
# CACHE_DRIVER=file
CACHE_DRIVER=redis
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database
# SESSION_DRIVER=file
SESSION_DRIVER=redis
SESSION_LIFETIME=120
Imma go and cry at the corner of the room and re-trying this tommorow. 😄
ModestasV
ModestasV4mo ago
Heh... I'm not really able to re-produce this :/
Rolland
Rolland4mo ago
its alright, thank you for trying.
ericmp
ericmpOP4mo ago
im doing the same xdd, but till today afternoon (,:
<script data-navigate-once="">
window.Echo = new window.EchoFactory(JSON.parse('{\u0022broadcaster\u0022:\u0022reverb\u0022,\u0022key\u0022:\u0022ikxc2rphm2ib85ppgakv\u0022,\u0022host\u0022:\u0022chat.tallstack.cat\u0022,\u0022port\u0022:\u0022443\u0022,\u0022scheme\u0022:\u0022https\u0022,\u0022authEndpoint\u0022:\u0022\\\/broadcasting\\\/auth\u0022,\u0022enabledTransports\u0022:[\u0022ws\u0022,\u0022wss\u0022]}'))

window.dispatchEvent(new CustomEvent('EchoLoaded'))
</script>
<script data-navigate-once="">
window.Echo = new window.EchoFactory(JSON.parse('{\u0022broadcaster\u0022:\u0022reverb\u0022,\u0022key\u0022:\u0022ikxc2rphm2ib85ppgakv\u0022,\u0022host\u0022:\u0022chat.tallstack.cat\u0022,\u0022port\u0022:\u0022443\u0022,\u0022scheme\u0022:\u0022https\u0022,\u0022authEndpoint\u0022:\u0022\\\/broadcasting\\\/auth\u0022,\u0022enabledTransports\u0022:[\u0022ws\u0022,\u0022wss\u0022]}'))

window.dispatchEvent(new CustomEvent('EchoLoaded'))
</script>
Rolland
Rolland4mo ago
did you manage to make it working?
ericmp
ericmpOP4mo ago
not yet :/ and u?
Rolland
Rolland4mo ago
if i found solution i would share here.
wazkaz
wazkaz4mo ago
Hey guys. I have exactly the same problem. The console log returns this error: WebSocket is closed before the connection is established., I've been trying to solve it for a few days, but not much success yet. So I am also searching the solution if i found something I will tell.
ModestasV
ModestasV4mo ago
Does anyone have this in a publicly available repo/setting to reproduce?
Rolland
Rolland4mo ago
for me the problem only occurs when using ssl, it worked fine when not using ssl. i am using apache btw
ericmp
ericmpOP4mo ago
hmm okay. r u doing it in ur machine or in a server?
Rolland
Rolland4mo ago
on my machine
ericmp
ericmpOP4mo ago
noup :/ (yet ig) okay im doing it on a server, and im using https / ssl
Rolland
Rolland4mo ago
i found this discussion. maybe it could help you. https://github.com/laravel/framework/discussions/50675
GitHub
Laravel Reverb in Production · laravel framework · Discussion #50675
I have created a sample laravel 11 project and in which I have configured all the requirements for the laravel reverb. In local machine/setup reverb is working fine. when I deployed in production s...
ericmp
ericmpOP4mo ago
appreciate it the problem though is that i actually can use reverb, im using it with a project in that same server using livewire but i cant make it to work inside the admin panel its been hours again this is not what is happening
ericmp
ericmpOP4mo ago
somehow it struggles cuz of the keys of the env or something
No description
ericmp
ericmpOP4mo ago
i went to a project where reverb worked and tried to change the keys to test i did it + php artisan optimize:clear. at first, it worked, sending reverb events cool but then i go back as it was before and doesnt work anymore i get this error i tried to google how to generate reverb keys again or refresh them or something but i dont find anything the problem was that i thought i was restarting reverb doing: sudo supervisorctl reread; sudo supervisorctl update; sudo supervisorctl start all; but it actually is: php artisan reverb:restart; now seems it works, im gonna debug further and update it here in the chat

Did you find this page helpful?