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
ericmpOP2w 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
Rolland2w ago
have you figure out how to make reverb work with filament?
ModestasV
ModestasV2w ago
@ericmp @Rolland please ping me if you have issues with this still. I'm the one that wrote that article 🙂
ericmp
ericmpOP2w ago
please read my message, i already sent this link not yet i still do ^^
ModestasV
ModestasV2w ago
Can you show your .env configuration and filament.php section on boardcasting? (.env is needed around reverb/vite)
ericmp
ericmpOP2w 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
ModestasV2w 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
ericmpOP2w 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
ModestasV2w ago
But why? 🙂
ericmp
ericmpOP2w ago
why what? what point in specifically?
ModestasV
ModestasV2w ago
Reverb port !== https port
ericmp
ericmpOP2w ago
no is the same cuz then i reverse proxy
ModestasV
ModestasV2w ago
Well.. you are complicating your setup 😄 In that case, I can't help much if that's the breaking thing 🙂
ericmp
ericmpOP2w ago
oh, so is not needed? i mean, in terms of nginx i dont have to configure anything to make reverb work?
ModestasV
ModestasV2w ago
ps. I would first make it work with defaults as much as possible, then see what doesn't work
ModestasV
ModestasV2w 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
ModestasV2w ago
@ericmp you should follow the official docs for prod deployment 😉
ericmp
ericmpOP2w 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
ModestasV2w ago
But wait, is the reverb not working on prod only?
ericmp
ericmpOP2w 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
ModestasV2w ago
Oh... 🙂
ericmp
ericmpOP2w ago
so how u configured reverb. on prod? id like to know what u did (:
ModestasV
ModestasV2w ago
To be fair, followed the official docs 😄
ericmp
ericmpOP2w ago
and inside admin panel, just works?
ModestasV
ModestasV2w ago
But I made sure that everything works locally first Yeah, it worked just fine with the panel 🙂
ericmp
ericmpOP2w 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
ModestasV2w 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
ericmpOP2w 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
ModestasV2w ago
where do you get this error?
ericmp
ericmpOP2w ago
in a filament admin page where i try to connect to a defined channel
ModestasV
ModestasV2w ago
Can you search your html of the site to see what configuration it generated. Specifically search for: window.Echo = new window.EchoFactory(
ericmp
ericmpOP2w ago
u mean in the build echo js public file?
ModestasV
ModestasV2w 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
ericmpOP2w ago
ah okay, u mean, go to the admin panel chat page - browser open dev tools and search for that?
ModestasV
ModestasV2w ago
yes but not just chat page, to be fair - any page. As soon as filament loads it should connect
ericmp
ericmpOP2w 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
Rolland2w ago
do i need to run "npm install --save-dev laravel-echo pusher-js"? I am on L10.
ericmp
ericmpOP2w ago
afaik u dont need to, since if u run php artisan install:broadcasting it already does it
Rolland
Rolland2w ago
but L10 does not have that command. My thought was Filament already have this installed.
ericmp
ericmpOP2w 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
Rolland2w 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
ericmpOP2w ago
share ur .env keys related to reverb
Rolland
Rolland2w 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
ModestasV2w ago
Check network tab for wss connections and see what error it has
Rolland
Rolland2w ago
this?
No description
ModestasV
ModestasV2w ago
Okay, can you run reverb with --debug flag? see if it even makes a connection
Rolland
Rolland2w ago
my env
REVERB_HOST="procurement.dev"
REVERB_PORT=8080
REVERB_SCHEME=http
REVERB_HOST="procurement.dev"
REVERB_PORT=8080
REVERB_SCHEME=http
Rolland
Rolland2w ago
No description
Rolland
Rolland2w ago
if it help, I have ssl enabled.
ModestasV
ModestasV2w ago
So that's your problem then you need the schema to be https 🙂
Rolland
Rolland2w ago
i set the REVERB_SCHEME=https and restart the reverb. I still got the same problem.
No description
Rolland
Rolland2w ago
WebSocket is closed before the connection is established.
WebSocket is closed before the connection is established.
ModestasV
ModestasV2w ago
show your broadcasting config section 🙂
ModestasV
ModestasV2w ago
In filament, not this file 🙂 This file does nothing to filament config filament.php configuration file
Rolland
Rolland2w 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
ModestasV2w ago
Hmm, did you register broadcasting routes correctly? Can you check the list?
Rolland
Rolland2w ago
list?
ModestasV
ModestasV2w ago
php artisan route:list
Rolland
Rolland2w ago
GET|POST|HEAD broadcasting/auth ................................................................. Illuminate\Broadcasting › BroadcastController@authenticate
GET|POST|HEAD broadcasting/auth ................................................................. Illuminate\Broadcasting › BroadcastController@authenticate
is it this one?
ModestasV
ModestasV2w ago
yep, seems to be okay... hmm
Rolland
Rolland2w 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
ModestasV2w ago
Heh... I'm not really able to re-produce this :/
Rolland
Rolland2w ago
its alright, thank you for trying.
ericmp
ericmpOP2w 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
Rolland5d ago
did you manage to make it working?
ericmp
ericmpOP5d ago
not yet :/ and u?
Rolland
Rolland5d ago
if i found solution i would share here.
wazkaz
wazkaz5d 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
ModestasV5d ago
Does anyone have this in a publicly available repo/setting to reproduce?
Rolland
Rolland3d ago
for me the problem only occurs when using ssl, it worked fine when not using ssl. i am using apache btw
ericmp
ericmpOP3d ago
hmm okay. r u doing it in ur machine or in a server?
Rolland
Rolland3d ago
on my machine
ericmp
ericmpOP3d ago
noup :/ (yet ig) okay im doing it on a server, and im using https / ssl
Rolland
Rolland3d 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
ericmpOP22h 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
ericmpOP22h ago
somehow it struggles cuz of the keys of the env or something
No description
ericmp
ericmpOP22h 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
Want results from more Discord servers?
Add your server