Elliot_putt's avatar

New Reverb Configuration

Hi all, i am trying to install reverb on an api Back end with a Vue 3 front end on a separate app. I am having trouble getting the initial request to go through but not sure why?

I have this is my main js file which is all getting picked up and fired off fine but not succesfully:

import Echo from 'laravel-echo'

import Pusher from 'pusher-js'
window.Pusher = Pusher

window.Echo = new Echo({
  broadcaster: 'reverb',
  key: import.meta.env.VITE_REVERB_APP_KEY,
  wsHost: import.meta.env.VITE_REVERB_HOST,
  wsPort: import.meta.env.VITE_REVERB_PORT,
  wssPort: import.meta.env.VITE_REVERB_PORT,
  forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
  enabledTransports: ['ws', 'wss'],
})

my Front end env

VITE_REVERB_APP_KEY=qgoeijuhbv4vf0tv5rvu
VITE_REVERB_HOST=localhost
VITE_REVERB_PORT=8080
VITE_REVERB_SCHEME=http

My BE keys:

REVERB_APP_ID=897151
REVERB_APP_KEY=qgoeijuhbv4vf0tv5rvu
REVERB_APP_SECRET=wtfjkzdelikf7q8vv1ie
REVERB_HOST="localhost"
REVERB_PORT=8080
REVERB_SCHEME=http

And then this my request from the network pane on my front end:

wss://localhost:8080/app/qgoeijuhbv4vf0tv5rvu?protocol=7&client=js&version=8.4.0-rc2&flash=false

also starting reverb:

 dce php artisan reverb:start --debug

   INFO  Starting server on 0.0.0.0:8080 (localhost).

  Pruning Stale Connections ..........................................................................................
  Pinging Inactive Connections .........................

it just has no response and doesn't do anything not to sure where im going wrong?

0 likes
10 replies
hamzaelmaghari's avatar

Looks nothing wrong with your code, maybe you should replace localhost with 127.0.0.1.

Which OS do you run?

faanigee's avatar

I have done it in local environment but in production it is still not working

lpheller's avatar

Are you trying to use a public or a private channel?

karu's avatar

@lpheller i'm trying to set up a private channel. No success so far and there is no guide on internet for Laravel API and vue 3 for private chat. Just public rooms and web.php updates with livewire without auth etc.....

lpheller's avatar

@karu Yeah I know, all examples showing how easy Reverb is only cover a very basic / default setup. Do you have trouble with the initial connection or already got that established (playing ping pong) but the events are not broadcasted on the private channel?

For private channels you need to get the authorization right. Strangely, there was a whole bunch of instructions removed from the laravel echo docs in v11 regarding the authorization part. Take a look at the docs for Laravel v10 - Authorizing Channels

1 like

Please or to participate in this conversation.