reverb: Don't connect the form to the server socket

Reverb Version

1.0@beta

Laravel Version

v11.0.5

PHP Version

8.3

Description

I tried with the Postman and is connected well and returns the data and socket ID but javascript does not work I don’t know where the issue

env file

APP_URL=https://reverb.test

BROADCAST_CONNECTION=reverb

REDIS_CLIENT=phpredis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

REVERB_APP_ID=218623
REVERB_APP_KEY=laravel-key
REVERB_APP_SECRET=laravel-secret
REVERB_HOST="reverb.test"
REVERB_PORT=8080
REVERB_SCHEME=https

VITE_APP_NAME="${APP_NAME}"
VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="${REVERB_HOST}"
VITE_REVERB_PORT="${REVERB_PORT}"
VITE_REVERB_SCHEME="${REVERB_SCHEME}"

echo.js

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 ?? 80,
    wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
    forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
    enabledTransports: ['ws', 'wss'],
});

Screenshot 2024-03-13 at 9 25 55 PM

Steps To Reproduce

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Comments: 47 (18 by maintainers)

Most upvoted comments

Hi @joedixon! I have a similar problem. At first I tried to connect Reverb on the current project, but I got the error WebSocket connection to... in the browser console. Then I did a clean install of Laravel using docker in a WSL environment. And I still get the same error: WebSocket connection to 'ws://localhost:8080/app/vorzsu5irbdva48qipku?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed:

image

sail artisan reverb:start --debug:

INFO  Starting server on 0.0.0.0:8080 (localhost).

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

.env:

APP_URL=http://localhost

BROADCAST_CONNECTION=reverb

REVERB_APP_ID=222435
REVERB_APP_KEY=vorzsu5irbdva48qipku
REVERB_APP_SECRET=uig8whxhdpkafmocbn4u
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}"

echo.js:

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 ?? 80,
    wssPort: import.meta.env.VITE_REVERB_PORT ?? 443,
    forceTLS: (import.meta.env.VITE_REVERB_SCHEME ?? 'https') === 'https',
    enabledTransports: ['ws', 'wss'],
});

I use WSL and Laravel Sail. The server is started using the command sail artisan serve

I also encountered this using Laravel Sail (Windows, WSL, Laravel 10 upgraded to 11).

By adding port 8080 (used by Reverb) to docker-compose.yml solved the problem.

Udklip

I have exactly the same problem

Web server: Lightspeed Laravel: version 11

error :

app-CamLVODr.js:13 WebSocket connection to 'wss://mydomain.com/app/cmjnsrygmqfjkdrsmxib?protocol=7&client=js&version=8.4.0-rc2&flash=false' failed:

@lsdevelop I can say that I do not believe this is related to the upgrade. I did a diff check on a fresh project and made sure everything was setup the same as a new project. That said, when I upgraded, it did not add the broadcast config for Reverb…but this did not resolve my issue.

Note: The upgrade/broadcast config issue was just resolved here - #84

@joedixon Can you share the Reverb start command you used for SSL? Did you just run php artisan reverb:start or was it more than that?

After update broadcast.php, the connection has return this, i`m continue trying. image

@joedixon - Apologies, I should have made it clearer above - I changed the 0.0.0.0 to my reverb-test.test domain and that worked on a http connection, but SSL still has issues when trying https. However I think you’ve cleared it up with the following statement above

The built-in Reverb service doesn’t have SSL support (yet).