Coder Social home page Coder Social logo

reverb's Introduction

laravel reverb logo

Build Status Total Downloads Latest Stable Version License

Introduction

Laravel Reverb brings real-time WebSocket communication for Laravel applications.

Official Documentation

Documentation for Reverb can be found on the Laravel website.

Contributing

Thank you for considering contributing to Reverb! The contribution guide can be found in the Laravel documentation.

Code of Conduct

In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

Laravel Reverb is open-sourced software licensed under the MIT license.

reverb's People

Contributors

amirrezam75 avatar arthurpatriot avatar boris-glumpler avatar calc2te avatar caneco avatar colq2 avatar crynobone avatar cryptoprof avatar driesvints avatar fludem avatar ging-dev avatar jabools avatar joedixon avatar kirills-morozovs avatar l3aro avatar martyhimmel avatar michaelnabil230 avatar nunomaduro avatar olebowle avatar oussamamater avatar pnlinh-it avatar pyr0hu avatar stephenfrank avatar taylorotwell avatar timacdonald avatar wgriffioen avatar xico2k avatar yourchocomate avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reverb's Issues

Authorization. Token verification.

How can authorization be implemented if reverb is configured for multiple applications "located in different places". To check if the token is up to date at the moment of time from the application that broadcasts to the reverb server. Only REVERB_APP_KEY, REVERB_APP_SECRET and allowed_origins looks somehow unreliable.

Payload too large

Reverb Version

1.0

Laravel Version

11.0.3

PHP Version

8.3

Description

Hello, I am using laravel reverb and sending bigger data and getting exception Payload is too large. do you have an idea how to overcome this? looking for 50-100 kb message size limit, checked that on Discord and some ppl told me its bug probably, so reporting here. thank you so much.

Steps To Reproduce

do bigger messages 50kb+

Broadcast message toOthers throws ApiException in pusher

Reverb Version

1.0.0-beta4

Laravel Version

11.1.0

PHP Version

8.3.4

Description

When i try to send broadcast message via my Event like this
broadcast(new MyEvent())->toOthers()
I receive an Exception

[2024-03-28 16:26:08] local.ERROR: Pusher error: Internal server error.. {"exception":"[object] (Illuminate\\Broadcasting\\BroadcastException(code: 0): Pusher error: Internal server error.. at /home/ss/workspace/chat/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:164)
[stacktrace]
#0 /home/ss/workspace/chat/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(92): Illuminate\\Broadcasting\\Broadcasters\\PusherBroadcaster->broadcast()

In laravel-websockets, which i used before, same method work without errors.

Steps To Reproduce

broadcast(new MyEvent())->toOthers()
receive exception

[2024-03-28 16:26:08] local.ERROR: Pusher error: Internal server error.. {"exception":"[object] (Illuminate\\Broadcasting\\BroadcastException(code: 0): Pusher error: Internal server error.. at /home/ss/workspace/chat/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:164)
[stacktrace]
#0 /home/ss/workspace/chat/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(92): Illuminate\\Broadcasting\\Broadcasters\\PusherBroadcaster->broadcast()

When i add in Reverb inside handleRequest method of Laravel\Reverb\Servers\Reverb\Http\Server
$this->close($connection, 500, $e->getMessage());

instead of
$this->close($connection, 500, 'Internal server error.');
Which a give ZERO info about what happening inside this error
I receive some more info

message
: 
"Pusher error: Undefined array key \"875833828.561499442\"."

Maybe problem in line
isset($payload['socket_id']) ? $this->channels->connections()[$payload['socket_id']]->connection() : null
But didn't understand what is wrong. When remove ->toOthers() - all work good
Thank you

TTY mode is not supported on Windows platform.

Reverb Version

@beta

Laravel Version

11.0.0

PHP Version

8.2.12

Description

Im getting the error on windows:
TTY mode is not supported on Windows platform.
when installing reverb at the point when i am prompted to answer the question

Would you like to install and build the Node dependencies required for broadca
sting? (yes/no)

Steps To Reproduce

I have run the command that installs Reverb on windows
php artisan install:broadcasting

the error occurs when I accept in the affirmative to the question below
Would you like to install and build the Node dependencies required for broadcasting? (yes/no)

Laravel Reverb in Production Server

Reverb Version

1.0

Laravel Version

11

PHP Version

8.2

Description

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 server for testing I am getting the bellow error.
Screenshot 2024-03-20 at 11 15 08 PM

Steps To Reproduce

  • Defined SSL cert and ket path correctly
  • port 8080 is not blocked which can be accessed from any machine
  • tried with and without https for reverb hosting server
  • tried with localhost as reverb host

None of the above helped me. Kindly help me on this.

.env

APP_NAME=Laravel
APP_ENV=local
APP_KEY=base64:8aOIIcWglqC0snCZJgA33uCG68BQ2riXec7qLR2M8pg=
APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=https://reverb.amypo.com

APP_LOCALE=en
APP_FALLBACK_LOCALE=en
APP_FAKER_LOCALE=en_US

APP_MAINTENANCE_DRIVER=file
APP_MAINTENANCE_STORE=database

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=reverb
DB_USERNAME=root
DB_PASSWORD='0birj@4hMatA*RM}'

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
SESSION_DOMAIN=null

BROADCAST_CONNECTION=reverb
FILESYSTEM_DISK=local
QUEUE_CONNECTION=database

CACHE_STORE=database
CACHE_PREFIX=

MEMCACHED_HOST=127.0.0.1

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

MAIL_MAILER=log
MAIL_HOST=127.0.0.1
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

VITE_APP_NAME="${APP_NAME}"

REVERB_APP_ID=864321
REVERB_APP_KEY=xypigyotzowvifsmqzuw
REVERB_APP_SECRET=owz65aaetqlxgjqvd8s3
REVERB_HOST="websockets.amypo.com"
REVERB_PORT=8080
REVERB_SCHEME=https

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

config/reverb.php

  'servers' => [

       'reverb' => [
           'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
           'port' => env('REVERB_SERVER_PORT', 8080),
           'hostname' => env('REVERB_HOST'),
           'options' => [
                'tls' => [
               'local_cert' => '/etc/letsencrypt/live/websockets.amypo.com/fullchain.pem',
               'local_pk' => '/etc/letsencrypt/live/websockets.amypo.com/privkey.pem',
           ],
           ],
           'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000),
           'scaling' => [
               'enabled' => env('REVERB_SCALING_ENABLED', false),
               'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
           ],
           'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
       ],

   ],


   'apps' => [

       'provider' => 'config',

       'apps' => [
           [
               'key' => env('REVERB_APP_KEY'),
               'secret' => env('REVERB_APP_SECRET'),
               'app_id' => env('REVERB_APP_ID'),
               'options' => [
                   'host' => env('REVERB_HOST'),
                   'port' => env('REVERB_PORT', 443),
                   'scheme' => env('REVERB_SCHEME', 'https'),
                   'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
               ],
               'allowed_origins' => ['*'],
               'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60),
               'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000),
           ],
       ],

   ],

Presence of `"aws/aws-sdk-php"` in the dependencies?

Reverb Version

1.0.0

Laravel Version

11.0

PHP Version

any

Description

Hi there!

Is the "aws/aws-sdk-php" package really required to run Reverb? 🙂
As it's quite a heavy one (around 40MB), I guess getting rid of it could be good, if it's not actually required by Reverb?

Steps To Reproduce

  • Install Reverb
  • Check the dependencies - especially the size of the vendor/aws/aws-sdk-php folder

Laravel Reverb throw an error when stop using keyboard

Reverb Version

1.0.0-beta2

Laravel Version

11.0.6

PHP Version

8.3.1

Description

I have installed fresh laravel 11.0.6 with jetstream vue stack. Then I install the reverb package.

After that I start reverb server using php artisan reverb:start also php artisan reverb:start --debug . When I try to stop server using keyboard ctrl + c it take a bit time then throw the following error. I attached the screenshot with error details

2024-03-15_145033

   INFO  Starting server on 0.0.0.0:8080.

   INFO  Gracefully terminating connections.  


   TypeError 

  Laravel\Reverb\ConfigApplicationProvider::findById(): Argument #1 ($id) must be of type string, null given, called in F:\laragon\www\laravel11\vendor\laravel\reverb\src\ConfigApplicationProvider.php on line 27

  at vendor\laravel\reverb\src\ConfigApplicationProvider.php:36
     32▕      * Find an application instance by ID.
     33▕      *
     34▕      * @throws \Laravel\Reverb\Exceptions\InvalidApplication
     35▕      */
  ➜  36public function findById(string $id): Application
     37▕     {
     38return $this->find('app_id', $id);
     39▕     }
     401   vendor\laravel\reverb\src\ConfigApplicationProvider.php:27
      Laravel\Reverb\ConfigApplicationProvider::findById()

  2   [internal]:0
      Laravel\Reverb\ConfigApplicationProvider::Laravel\Reverb\{closure}()```



### Steps To Reproduce

Github repo : https://github.com/fftfaisal/laravel11

Don't assume resources/js is present

Reverb Version

1.0.0

Laravel Version

11.0

PHP Version

8.3

Description

I am using Laravel purely as a backend HTTP API but your installer assumes /resources/js should exist, which it does not in my case.

Teherefore I get this error when running art install:broadcasting

copy(/var/www/resources/js/echo.js): Failed to open stream: No such file or directory at vendor/laravel/framework/src/Illuminate/Foundation/Console/BroadcastingInstallCommand.php:58

Steps To Reproduce

  1. php artisan install:broadcasting

Invalid response data of event pusher_internal:subscription_succeeded

Reverb Version

v1.0.0-beta3

Laravel Version

v11.0.7

PHP Version

8.2.17

Description

According Pusher protocol documentation, after subscribe to presence channel success, the ids field in data response of the event pusher_internal:subscription_succeeded should be Array.

Currently, Reverb response a map with key is socketId:

image

image

After take a look at Reverb, I see that the response data is handled at: InteractsWithPresenceChannels.php#L76.

Currently it uses all() method to get array from collection but it will keep the array key. So I think we should use ->values()->all() to reset the array key.

I wonder if i can create PR?

Steps To Reproduce

I created demo project at here: https://github.com/pnlinh-it/demo-revert-issue

High CPU usage

Reverb Version

v1.0.0-beta4

Laravel Version

11.0.8

PHP Version

8.2.17

Description

After a day or so, I'm getting 100% CPU usage on the reverb:start process. If I restart reverb, it goes down to 1% CPU.

It's currently doing 160 odd users online in presence channel and that's about it. Had the same problem with this package: beyondcode/laravel-websockets#379

Screenshot 2024-03-23 at 7 49 30 PM

Steps To Reproduce

Have a reverb server running via reverb:start for a day with many presence connections (150+).

WebSocket Connection Fails with SSL and Laravel Event Dispatching Error

Reverb Version

@beta

Laravel Version

11.0.3

PHP Version

8.2

Description

I am currently facing an issue with my Laravel application when I try to use SSL. The application works fine without SSL, but when I add a Let's Encrypt SSL certificate, the WebSocket connection fails. Here is my Nginx configuration:

map $http_upgrade $type { default "web"; websocket "ws"; }
server {
listen 80;
listen [::]:80;
root /home/ploi/reverb.devcloud.dz/public;
server_name reverb.devcloud.dz;
include /etc/nginx/ssl/reverb.devcloud.dz;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:ECDHE-ECDSA-DES-CBC3-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:DES-CBC3-SHA:!DSS';
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/nginx/dhparams.pem;
index index.php index.html;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
include /etc/nginx/ploi/reverb.devcloud.dz/server/;
location / {
try_files /nonexistent @$type;
}
location @web {
try_files $uri $uri/ /index.php?$query_string;
}
location @ws {
proxy_pass http://0.0.0.0:8080;
proxy_set_header Host $host;
proxy_read_timeout 60;
proxy_connect_timeout 60;
proxy_redirect off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
access_log off;
error_log /var/log/nginx/reverb.devcloud.dz-error.log error;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ .php$ {
try_files $uri /index.php =404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
fastcgi_buffers 16 16k;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
include fastcgi_params;
}
location ~ /.(?!well-known).
{
deny all;
}
}

Additionally, when I dispatch an event, the job fails and I receive the following error:

[2024-03-14 18:56:42] production.ERROR: Pusher error: cURL error 28: Operation timed out after 10001 milliseconds with 0 out of 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://reverb.devcloud.dz:8080/apps/100838/events?auth_key=7vifn5r8izbayiijog1r&auth_timestamp=1710442592&auth_version=1.0&body_md5=71097622162ba803476e118aee1fabc5&auth_signature=e3e95e6e2edc190b1f7887a0c2786d04e73a76825cc5986dea440d572e75a87f. {"exception":"[object]
Screenshot from 2024-03-14 19-48-55

Steps To Reproduce

And this is my .env conf

REVERB_APP_ID=100838
REVERB_APP_KEY=7vifn5r8izbayiijog1r
REVERB_APP_SECRET=vr3ptchygcmdq6peri5f
REVERB_HOST="reverb.devcloud.dz"
REVERB_PORT=8080
REVERB_SCHEME=https

BROADCAST_CONNECTION=reverb

VITE_REVERB_APP_KEY="${REVERB_APP_KEY}"
VITE_REVERB_HOST="reverb.devcloud.dz"
VITE_REVERB_PORT=443
VITE_REVERB_SCHEME="${REVERB_SCHEME}"

Supporting channel events / webhooks

Hi,

First of all, thanks for the awesome package!

We are currently using soketi and wanted to migrate over, but as far as I see Reverb currently not supporting webhooks and we are heavily relying on the channel occupied / vacated webhook events.

I just wanted to ask if is there any plan to implement webhooks or even better to have the ability to fire a Job when a specific event happened?

Thanks for the reply!

Does not work on Windows

Reverb Version

beta

Laravel Version

10.48

PHP Version

8.2

Description

Hello, unable to run the "php artisan reverb:start" command on Windows.

Here is the error:
In StartServer.php line 150:

Undefined constant "Laravel\Reverb\Servers\Reverb\Console\Commands\SIGINT"

It appears that Reverb uses the PCNTL PHP extension which is not available on Windows.

There was the same problem on Laravel 11 and a fix was made.

Would it also be possible to have a fix for Windows?

Thanks in advance

Steps To Reproduce

Install Laravel Reverb on windows on Laravel 10.48 then run php artisan reverb:start

Application crashes if an app of type string was not provided

Reverb Version

1.0.0-beta4

Laravel Version

11

PHP Version

8.2

Description

Sometimes I'm getting this error:

  Laravel\Reverb\ConfigApplicationProvider::findById(): Argument #1 ($id) must be of type string, null given, called in /Users/samuelrac/stack/whatscompany/grp_ipchat/ipchat-websocket-server/vendor/laravel/reverb/src/ConfigApplicationProvider.php on line 27

  at vendor/laravel/reverb/src/ConfigApplicationProvider.php:36
     32▕      * Find an application instance by ID.
     33▕      *
     34▕      * @throws \Laravel\Reverb\Exceptions\InvalidApplication
     35▕      */
  ➜  36▕     public function findById(string $id): Application
     37▕     {
     38▕         return $this->find('app_id', $id);
     39▕     }
     40▕ 

      +1 vendor frames 

  2   [internal]:0
      Laravel\Reverb\ConfigApplicationProvider::Laravel\Reverb\{closure}()
      +18 vendor frames 

  21  [internal]:0
      React\EventLoop\ExtEvLoop::React\EventLoop\{closure}()

After that, the application needs to be started again

Steps To Reproduce

The problem is intermittent, so I don't know what is causing this problem.

Linux: Undefined constant SIGINT

Reverb Version

v1.0.0-beta4

Laravel Version

11.0.7

PHP Version

8.2.17

Description

I'm trying to get reverb to run on a Docker image (Debian GNU/Linux 12 (bookworm)).
Similar issues (#65, #74) have been created, but the problem seems not to be resolved for this case.

Steps To Reproduce

Dockerfile

FROM php:8.2
RUN apt-get update -y && apt-get install -y openssl zip unzip git
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /app
RUN composer create-project --prefer-dist laravel/laravel:^11.0 .
RUN composer require laravel/reverb:@beta
CMD php artisan reverb:start

docker-compose.yml

version: "3"
services:
    reverb:
        container_name: reverb
        build: .

Results in error:

   Error 

  Undefined constant "Laravel\Reverb\Servers\Reverb\Console\Commands\SIGINT"

  at vendor/laravel/reverb/src/Servers/Reverb/Console/Commands/StartServer.php:152
    148▕      */
    149▕     public function getSubscribedSignals(): array
    150▕     {
    151▕         if (! windows_os()) {
  ➜ 152▕             return [SIGINT, SIGTERM, SIGTSTP];
    153▕         }
    154▕ 
    155▕         $this->handleSignalWindows();
    156▕ 

      +4 vendor frames 

  5   artisan:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

grafik

When I run this Dockerfile:

FROM php:8.2
RUN apt-get update -y && apt-get install -y openssl zip unzip git
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /app
RUN composer create-project --prefer-dist laravel/laravel:^11.0 .
RUN composer require laravel/reverb:@beta
RUN chmod u+rw /dev/tty
CMD php artisan reverb:install && php artisan reverb:start

I get this error:

   Symfony\Component\Process\Exception\RuntimeException 

  TTY mode requires /dev/tty to be read/writable.

  at vendor/symfony/process/Process.php:1017
    1013▕             throw new RuntimeException('TTY mode is not supported on Windows platform.');
    1014▕         }
    1015▕ 
    1016▕         if ($tty && !self::isTtySupported()) {
  ➜ 1017▕             throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
    1018▕         }
    1019▕ 
    1020▕         $this->tty = $tty;
    1021▕

      +29 vendor frames 

  30  artisan:13
      Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))

grafik

broadcast() event triggers weird OpennSSL error.

Reverb Version

v1.0.0-beta4

Laravel Version

11.0.7

PHP Version

8.3.4

Description

In an existing application, trying to switch from Pusher to Reverb I get the following error when calling the broadcast(new MyEvent()) function:

OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 0 (curl_errno is 56)

This event is triggered when a user calls an API endpoint, that should broadcast an event to other clients via a PresenceChannel.

I'm not really sure why i get the error as I can do the request via cURL CLI, but not PHP cURL:

curl -H 'Content-Type: application/json' \
     -d '{ "auth_key":"zhmgy7ydlqqdpuejplvw","auth_timestamp":1710932537, "auth_version": 1.0, "body_md5": "91dcf3a486bd51567cd491c799969ff9", "auth_signature": "41eb3db4b84b44aa7a7879822ec0f8dde4b1d856ed5eb53be042699de253860f"}' \
     -X POST \
     https://localhost:8080/apps/238231/events 

gives me a response:

{"name":["The name field is required."],"data":["The data field is required."],"channels":["The channels field is required when channel is not present."],"channel":["The channel field is required when channels is not present."]}

(I haven't investigated further if name/data/channels/channel is sent when using the broadcast() function, but that might be a second issue?)

I've also tried different settings for the broadcasting client_options but nothing works...

Steps To Reproduce

  1. New laravel app: composer create-project laravel/laravel:^11.0 example-app
  2. Install reverb: php artisan install:broadcasting
  3. Setup .env with https enabled for reverb. Since I'm working on a SPA-frontend in different repo, using vite dev, I've secured using mkcert, I've added the following to config/reverb.php. These are env variables are set to the path to certificates that mkcert creates:
'options' => [
    'tls' => [
        'local_cert' => env('REVERB_LOCAL_CERT'),
        'local_pk' => env('REVERB_LOCAL_PK'),
    ],
 ],
  1. Run php artisan reverb:start --host="0.0.0.0" --port=8080 --hostname="localhost"

Then using any API endpoint (secured with sanctum) that dispatches a broadcast() call triggers the error. I've also made a test script which shows the error that can be run, around my Laravel backend API:

<?php
$ch = curl_init();

curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, "https://localhost:8080/apps/238231/events");
curl_setopt($ch, CURLOPT_POSTFIELDS, "{ \"auth_key\":\"zhmgy7ydlqqdpuejplvw\",\"auth_timestamp\":1710932537, \"auth_version\": 1.0, \"body_md5\": \"91dcf3a486bd51567cd491c799969ff9\", \"auth_signature\": \"41eb3db4b84b44aa7a7879822ec0f8dde4b1d856ed5eb53be042699de253860f\"}");

curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json'
]);

curl_setopt($ch, CURLOPT_VERBOSE, true);
curl_setopt($ch, CURLOPT_STDERR, fopen('php://stderr', 'w'));
curl_setopt($ch, CURLOPT_CERTINFO, true);

// curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
// curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
// curl_setopt($ch, CURLOPT_SSLCERT, '/Users/rso/.ssl/localhost.pem');
// curl_setopt($ch, CURLOPT_SSLKEY, '/Users/rso/.ssl/localhost-key.pem');

$response = curl_exec($ch);

print_r([
    curl_errno($ch),
    curl_error($ch),
    $response
]);

curl_close($ch);

Dont respect max_message_size

Reverb Version

@beta

Laravel Version

11.0

PHP Version

8.3.3

Description

     [
                'key' => 'test',
                'secret' => 'test',
                'app_id' => 12347,
                'options' => [
                    'host' => '0.0.0.0',
                    'port' => 8080,
                    'scheme' => 'http',
                    'useTLS' => false,
                ],
                'allowed_origins' => ['*'],
                'ping_interval' => 60,
                'max_message_size' => 2500000,
            ],

Illuminate\Broadcasting\BroadcastException
Pusher error: Payload too large..

Steps To Reproduce

  1. install latest laravel
  2. intall latest reverb
  3. set max_message_size 2500000 (this is 2.5 Megabytes ??)
  4. if sent > 11kb payload. get error

Allow choosing redis connection

Objective

Allow to use another redis connection than the default one.

Why

Sometimes you don't have a default redis connection, or at least it doesn't contain the host and port keys, if you're using sentinel for instance.
While awaiting for the sentinel support, a great comprise can be to let us customise which redis connection is used for the websockets.

How

  1. In \Laravel\Reverb\Servers\Reverb\Publishing\RedisPubSubProvider::redisUrl function, use a configuration option to know which connection to use, or use the default one as a fallback.
  2. Update the documentation

Move connection parameters to phpunit env

Hello guys. What you think about to move all connections parameters to phpunit env. For example, I want to test reverb on windows machine, windows doesn't support creating socket connection on 0.0.0.0, I must use local ip. And now, I must add host parameter to each test where present host...

Will be easy to get this parameters from env ($host, $port, $appId). And code will be more clean and reusable. What you think?

Allow to configure Reverb base route

Currently all Reverb routes are hardcoded with /app.

This make difficult to configure Nginx reverse proxy based on location directive when you are using the same server to host your App + Laravel Reverb. Mainly because some cloud providers does not allow to expose on Internet multiples ports.

The only alternative currently is to configure as location /app/ { ... } but it is not safe and can lead to unexpected results.

Suggestion:

Add a new Reverb config like this

    'base_route' => env('REVERB_BASE_ROUTE', '/app')

Random "Pusher error: Internal server error." and slow on "larger" arrays, inconsistent speed

Reverb Version

beta 4

Laravel Version

11+

PHP Version

8.3

Description

So I decided to randomly test speed and payload size because I believe it's pretty inconsistent. I came up with a test and sometimes reverb would not send small payloads.

The config

max_request_size and max_message_size set to PHP_INT_MAX

The test

    $x = 0;
    $b = 0;
    for ($i = 0; $i < PHP_INT_MAX; $i += 1000) {
        event(new GnaQueueUpdatedEvent(range(0, $i)));
        if ($i % 1000 == 0) {
            $this->info("$i ($x) ~" . round($b / 1024 / 1024, 2) . 'mb');
            $x++;
            $b += $i;
        }
    }
class GnaQueueUpdatedEvent implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public array $gnaQueue;

    public function __construct(array $gnaQueue)
    {
        $this->gnaQueue = array_values($gnaQueue);
    }

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

    public function broadcastAs(): string
    {
        return 'GnaQueueUpdatedEvent';
    }

}

The result
I get between 1 and 100 iterations before it breaks with "Internal server error"

Sometimes its slow, sometimes its fast. Somethimes it times out. But one thing is consistent, its inconsistent on all my tests.

I wish I could be more concrete. Hint hint

Here is a 32 megabyte gif that show me run a couple of tests. The Reverb server does not have any clients connected besides Laravel.

EDIT
I could not add the gif in the issue: so I uploaded it to a repo

https://github.com/tarreislam/uploaded-files/blob/master/example%20of%20reverb.gif

Steps To Reproduce

See above

BUG: broadcasting.php required modifications

Laravel ver
10->11

PHP VER
8.3

Description+Reproduce

Before I could get reverb to broadcast eventsI had to make sure the configuration was done in config/broadcasting.php

        'reverb' => [ // notice reverb
            'driver' => 'reverb', // notice reverb
            'key' => env('PUSHER_APP_KEY', 'app-key'),
            'secret' => env('PUSHER_APP_SECRET', 'app-secret'),
            'app_id' => env('PUSHER_APP_ID', 'app-id'),
            'options' => [
                'host' => env('PUSHER_HOST', '127.0.0.1'),
                'port' => env('PUSHER_PORT', 6001),
                'scheme' => env('PUSHER_SCHEME', 'http'),
                'encrypted' => false,
                'useTLS' => env('PUSHER_SCHEME') === 'https',
            ]
        ],

I just copied pusher and changed name and driver to reverb

I am comming from laravel 10 to laravel 11

Otherwise I would get

Pusher error: auth_key should be a valid app key
.

  at vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:164
    160▕             $channels->chunk(100)->each(function ($channels) use ($event, $payload, $parameters) {
    161▕                 $this->pusher->trigger($channels->toArray(), $event, $payload, $parameters);
    162▕             });
    163▕         } catch (ApiErrorException $e) {
  ➜ 164▕             throw new BroadcastException(
    165▕                 sprintf('Pusher error: %s.', $e->getMessage())
    166▕             );
    167▕         }
    168▕     }

  i   Here are some links that might help solve this problem:
      https://laravel.com/docs/11.x/authentication
 

Type error in Reverb with GraphQL subscription (Lighthouse package)

Reverb Version

1.0.0-beta4

Laravel Version

10.48.4

PHP Version

8.2.17

Description

I am using the Laravel Reverb package with GraphQL subscriptions implemented using the Lighthouse package (v6.35.0). When a subscription request is received by Reverb, it throws the following error:

TypeError Laravel\Reverb\Protocols\Pusher\EventHandler::subscribe(): Argument #4 ($data) must be of type ?string, array given, called in /var/www/DemoGraphQL/vendor/laravel/reverb/src/Protocols/Pusher/EventHandler.php on line 29 at vendor/laravel/reverb/src/Protocols/Pusher/EventHandler.php:56

The error is caused by the payload data being an array instead of a string, which is expected by the subscribe method in the EventHandler class.

The payload that triggers the error looks like this:

{
    "event": "pusher:subscribe",
    "data": {
        "channel_data": {
            "user_id": "f76076ed4081e927b1a54bf510992f2c",
            "user_info": []
        },
        "channel": "private-lighthouse-uyeyl2Vnz2MXRHdVMly4lg2YnTKufVqS-1711692828"
    }
}

When running in --debug mode, an additional error is thrown:

TypeError json_decode(): Argument #1 ($json) must be of type string, array given at vendor/laravel/reverb/src/Loggers/CliLogger.php:57

This error occurs because the channel_data value in the payload is also being treated as an array instead of a string.

A possible fix for --debug might be to add a condition check for the channel_data value, similar to the existing check for the data value, before attempting to decode it using json_decode. The condition could be something like && is_string($message['data']['channel_data']).

Additional Information:

If you need any further details about the Lighthouse implementation or any other relevant information, I will provide them to help better understand and resolve the issue.

Steps To Reproduce

start a reverb server running via reverb:start or reverb:start --debug. Use the lighthouse package with the LIGHTHOUSE_BROADCASTER=echo driver.

Pusher error: cURL error 28: SSL connection timeout on send BroadcastMessage

Reverb Version

1.0.0-beta2

Laravel Version

11.0

PHP Version

8.3

Description

I`m using Laravel Herd with SSL, the connection from client is working, but after update to laravel 11 and reverb (to laravel websockets) server dispatch events returns this:

Illuminate\Broadcasting\BroadcastException: Pusher error: cURL error 28: SSL connection timeout (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://chatbot.test:8080/apps/1001/events?auth_key=laravel-herd&auth_timestamp=1710421780&auth_version=1.0&body_md5=ab56f5161458b3dd0bd6c2564b449cc7&auth_signature=fd8da35337c12f08b01a15104940b53393adc23477033ec3f659dea66d1f67ad. in /Users/lucassantos/PhpstormProjects/chatbot/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:164

My settings:

Herd: PHP Redis server, Real-Time reverb server
Laravel Horizon

composer:
"require": { "php": "^8.2.0", "aws/aws-sdk-php": "^3.256", "inertiajs/inertia-laravel": "^1.0", "laravel/framework": "^11.0", "laravel/horizon": "^5.23.1", "laravel/jetstream": "^5.0", "laravel/reverb": "@beta", "laravel/sanctum": "^4.0", "laravel/tinker": "^2.9.0", "league/flysystem-aws-s3-v3": "^3.24.0", "maatwebsite/excel": "^3.1", "opcodesio/log-viewer": "^v3.5.0", "pusher/pusher-php-server": "7.2.3", "tightenco/ziggy": "^2.0.4" }, "require-dev": { "fakerphp/faker": "^1.23.1", "lucascudo/laravel-pt-br-localization": "^v2.1.2", "mockery/mockery": "^1.6.9", "nunomaduro/collision": "^8.1", "phpunit/phpunit": "^10.5.11", "spatie/laravel-ignition": "^2.4.2" },

.env:
REVERB_APP_ID=1001 REVERB_APP_KEY=laravel-herd REVERB_APP_SECRET=secret REVERB_HOST=chatbot.test REVERB_PORT=8080 REVERB_SCHEME=https

config:
'reverb' => [ 'host' => env('REVERB_SERVER_HOST', '0.0.0.0'), 'port' => env('REVERB_SERVER_PORT', 8080), 'hostname' => env('REVERB_HOST'), 'options' => [ 'tls' => [], ], 'scaling' => [ 'enabled' => env('REVERB_SCALING_ENABLED', false), 'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'), ], 'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15), ],

broadcast message:
`<?php

namespace App\Notifications;

use App\Enums\GlobalNotificationType;
use App\Helpers\Disk;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\BroadcastMessage;
use Illuminate\Notifications\Notification;

class ExportCompletedNotification extends Notification implements ShouldQueue
{
use Queueable;

public function __construct(public string $path, public string $fileType)
{
    //
}

public function via($notifiable): array
{
    return ['database', 'broadcast'];
}

public function toBroadcast($notifiable): BroadcastMessage
{
    return new BroadcastMessage([
        'data' => [...],
    ]);
}

}`

ps: This system working in production with Laravel Websockets

Steps To Reproduce

  1. install herd with reverb and redis servers
  2. install laravel horizon
  3. enable server custom dns "laravel.test"
  4. enable server ssl
  5. create broadcast message
  6. dispatch notification message
  7. check laravel horizon fail logs

Database apps management

I some cases, we create a server to manage many apps, so, do this on a table is more useful than in a config file. Any chance of this become a feature?

Reverb process crashes if no $auth parameter is provided

Reverb Version

v1.0.0-beta3

Laravel Version

v11.0.6

PHP Version

8.3

Description

After putting reverb into production and replacing soketi everything worked fine for an hour and then I started receiving these errors which crash the reverb process:

2024-03-15 02:16:37] production.ERROR: Laravel\Reverb\Protocols\Pusher\Channels\PrivateChannel::verify(): Argument #2 ($auth) must be of type string, null given, called in /home/forge/xxxxxx/vendor/laravel/reverb/src/Protocols/Pusher/Channels/Concerns/InteractsWithPrivateChannels.php on line 16 {"exception":"[object] (TypeError(code: 0): Laravel\Reverb\Protocols\Pusher\Channels\PrivateChannel::verify():

I have fixed the error temporarily by modifying the signature of the verify method to match the subscribe method however I am unsure if this is the correct way to fix this issue:

protected function verify(Connection $connection, ?string $auth = null, ?string $data = null): bool

Steps To Reproduce

Pass a null $auth parameter while trying to connect to a private channel

Windows not supported (yet)?

Reverb Version

v1.0.0-beta2

Laravel Version

11.0.2

PHP Version

8.3.2

Description

When I install Reverb I get the error message:

Would you like to install and build the Node dependencies required for broadcasting? (yes/no) [yes]
❯

   INFO  Installing and building Node dependencies.


   Symfony\Component\Process\Exception\RuntimeException

  TTY mode is not supported on Windows platform.

  at vendor\symfony\process\Process.php:1013
    1009▕      */
    1010▕     public function setTty(bool $tty): static
    1011▕     {
    1012▕         if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  ➜ 1013▕             throw new RuntimeException('TTY mode is not supported on Windows platform.');
    1014▕         }
    1015▕
    1016▕         if ($tty && !self::isTtySupported()) {
    1017▕             throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');

Is Windows not supported for Reverb?

Steps To Reproduce

laravel new laravel11
php artisan install:broadcasting

Pusher error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0"

Reverb Version

v1.0.0-beta4

Laravel Version

v11.0.7

PHP Version

8.2.16

Description

I have Laravel reverb served in a subdomain on my server. Now I have connected to that subdomain from local with laravel-echo and there is no problem in eco connection.

But when I try to fire an event from the back-end I keep getting this error "Pusher error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.2.0" ". But I can't understand why it is showing.

But when I am locally using an application as a socket only and firing events from another application then everything is working fine only when I deploy reverb on the server there is a problem.

  • Local Reverb console
    image

My concept is that there will be a reverb server in a subdomain and everyone will connect to that reverb server subdomain from another domain.

Reverb + Valet SSL certificate problem: unable to get local issuer certificate

Reverb Version

1.0.0-beta3

Laravel Version

4.6.1

PHP Version

8.3.3

Description

I'm running on osx (14.2.1) with valet (4.6.1).
I have created a new laravel project (11.0.6) using the laravel new command.
I've secured my site using valet secure.

I've ran the artisan install:broadcasting to install reverb. I'm running the server very basic using artisan reverb:start --debug (also tried the command from the docs: php artisan reverb:start --host="0.0.0.0" --port=8080 --hostname="project.test") which gives me:

INFO Starting secure server on 0.0.0.0:8080 (project.test).

So far it seems good to me. I've created an event to test with. Because the event is queued, I run artisan queue:listen. Then I use tinker to send the message:

$newMessage = new \App\Events\NewMessage('Hello, world!');broadcast($newMessage)->toOthers();

The message is run in the queue listener, but fails. When I look in the log file, I see this message:

local.ERROR: cURL error 60: SSL certificate problem: unable to get local issuer certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for ...

I've checked to see if the certificates exists in the .config/valet directory and they do.

In my .env I've set REVERB_HOST=project.test as well.

Steps To Reproduce

  • Start new laravel project
  • Run artisan install:broadcast
  • Run artisan reverb:start
  • Send out a message using a laravel event
  • Watch it fail in the queue with artisan queue:listen

Does not work in Safari

Reverb Version

1.0.0-beta2

Laravel Version

11.0.5

PHP Version

8.3.3

Description

Laravel Reverb works fine in Chrome and Firefox but does not seem to work at all in Safari for me

Steps To Reproduce

Install Reverb, test in Chrome, FF, and Safari. Safari does nothing.

SSL Error with pusher and reverb

Reverb Version

beta4

Laravel Version

11.0.7

PHP Version

8.3.4 ubuntu 22.04

Description

I Have a bug :
cURL error 56: OpenSSL SSL_read: error:0A000126:SSL routines::unexpected eof while reading, errno 0 (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)
Error in : pusher-php-server/src/Pusher.php(776) post ok but error trigered !
PHP curl :
Libcurl : 7.81.0
OpenSSL : 3.0.2
I see similar problem , tried to changer curl config but nothing work.
I connect in websocket with wss + letsencrypt cert, pusherphpserver connect on https.

If my job $tries=3 it push the event 3 times ! So have to stay with 1 try, because the event is pushed, but the Job fail.

Tried a workaround : use http for pusher with 127.0.0.1 and wss + hostname for websocket.
Is is possible to have a wss server + http ?

Or any defaut config to change to fix this ssl problem ?
No problem with soketi and can't upgrade curl on ubuntu 22 LTS.

Steps To Reproduce

Use ubuntu server with letsencrypt cert + php 8.3 ondrej ppa + apache + redis + horizon
Error on every broadcast request

[Solved] Reverb not dispatching events in production

Reverb Version

@beta (out of the box after install)

Laravel Version

11.0

PHP Version

8.3.4

Description

In a local environment (non herd) with reverb:start when a event is dispatched I get the message in my console log. But in production on a Plesk server it does not. No error messages or anything in the logs that seem to point at the solution.

Steps To Reproduce

Create a new laravel installation, install broadcast.

local .env

REVERB_APP_ID=271094
REVERB_APP_KEY=esa4d8rnyeyadiexuram
REVERB_APP_SECRET=pyubfujwpiqrdwp60zhu
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}"

production .env

REVERB_APP_ID=271094
REVERB_APP_KEY=esa4d8rnyeyadiexuram
REVERB_APP_SECRET=pyubfujwpiqrdwp60zhu
REVERB_HOST="sub.domain.com"
REVERB_PORT=443
REVERB_SCHEME=https

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

In a controller:

class SampleController extends Controller
{
    public function store(Request $request){
        $message = $request->input('message');
        SampleEvent::dispatch($message);
        return response()->json(['success' => true, 'message' => 'Message sent successfully']);
    }
}

The Event

class SampleEvent implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public $message;

    /**
     * Create a new event instance.
     */
    public function __construct($message)
    {
        $this->message = $message;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return array<int, \Illuminate\Broadcasting\Channel>
     */
    public function broadcastOn(): Channel
    {
        return new Channel('sample');
    }

    public function broadcastAs(): string
    {
        return 'message.sent';
    }
}

On the front-end (works local but not in production)

  window.Echo.channel('sample')
        .listen('.message.sent', (e) => {
            console.log(e);
        })

On the server I have added 'additional nginx directives'

location /app {
	proxy_http_version 1.1;
	proxy_set_header Host $http_host;
	proxy_set_header Scheme $scheme;
	proxy_set_header SERVER_PORT $server_port;
	proxy_set_header REMOTE_ADDR $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection "Upgrade";

	proxy_read_timeout 300s;
	proxy_connect_timeout 75s;

	proxy_pass http://0.0.0.0:8080;
}

A connection on the front-end is made over wss://sub.domain.com/app/~~~~
In the debug of reverb I see a subscribe message to the channel:

1▕ {
   2▕     "event": "pusher:subscribe",
   3▕     "data": {
   4▕         "auth": "",
   5▕         "channel": "sample"
   6▕     }
   7▕ }

But the event doesn't trigger the messages being send in production, but they do in local development.

It feels like that the Laravel Framework is not able to send the message to the Reverb server for unknown reasons.

Reverb without Pulse throws error during optimize

Laravel Version

11

PHP Version

8.2

Database Driver & Version

No response

Description

Installing Reverb without pulse and then trying to
php artisan optimize
throws error

   INFO  Caching framework bootstrap, configuration, and metadata.

  config .............................................................................................................................. 73.77ms DONE
  events ............................................................................................................................... 2.51ms DONE
  routes .............................................................................................................................. 46.14ms DONE
  views ............................................................................................................................... 99.98ms FAIL

   InvalidArgumentException 

  Unable to locate a class or view for component [pulse::no-results].

I'm guessing it tries to cache a view in reverb package x-pulse::no-results

Steps To Reproduce

  1. php artisan install:broadcasting
    yes
    yes

  2. php artisan optimize

*EDIT
I think I created this bug report in the wrong place... But I'll still leave it here.

Getting Weird Pusher Error logged When I trigger an event yet I use reverb ({"exception":"[object] (Illuminate\\Broadcasting\\BroadcastException(code: 0): Pusher error:)

Reverb Version

1.0.0-beta4

Laravel Version

11.0

PHP Version

8.3.4

Description

[2024-03-23 03:12:41] local.ERROR: Pusher error: <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Bad request!</title>
<link rev="made" href="mailto:[email protected]" />
<style type="text/css"><!--/*--><![CDATA[/*><!--*/ 
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
/*]]>*/--></style>
</head>

<body>
<h1>Bad request!</h1>
<p>


    Your browser (or proxy) sent a request that
    this server could not understand.

</p>
<p>
If you think this is a server error, please contact
the <a href="mailto:[email protected]">webmaster</a>.

</p>

<h2>Error 400</h2>
<address>
  <a href="/">www.example.com</a><br />
  <span>Apache/2.4.54 (Unix) OpenSSL/1.1.1s PHP/8.2.0 mod_perl/2.0.12 Perl/v5.34.1</span>
</address>
</body>
</html>

. {"exception":"[object] (Illuminate\\Broadcasting\\BroadcastException(code: 0): Pusher error: <?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
  \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">
<head>
<title>Bad request!</title>
<link rev=\"made\" href=\"mailto:[email protected]\" />
<style type=\"text/css\"><!--/*--><![CDATA[/*><!--*/ 
    body { color: #000000; background-color: #FFFFFF; }
    a:link { color: #0000CC; }
    p, address {margin-left: 3em;}
    span {font-size: smaller;}
/*]]>*/--></style>
</head>

<body>
<h1>Bad request!</h1>
<p>


    Your browser (or proxy) sent a request that
    this server could not understand.

</p>
<p>
If you think this is a server error, please contact
the <a href=\"mailto:[email protected]\">webmaster</a>.

</p>

<h2>Error 400</h2>
<address>
  <a href=\"/\">www.example.com</a><br />
  <span>Apache/2.4.54 (Unix) OpenSSL/1.1.1s PHP/8.2.0 mod_perl/2.0.12 Perl/v5.34.1</span>
</address>
</body>
</html>


. at /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:164)
[stacktrace]
#0 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(92): Illuminate\\Broadcasting\\Broadcasters\\PusherBroadcaster->broadcast()
#1 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Broadcasting\\BroadcastEvent->handle()
#2 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#3 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#4 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#5 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#6 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\\Container\\Container->call()
#7 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Bus\\Dispatcher->Illuminate\\Bus\\{closure}()
#8 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#9 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\\Pipeline\\Pipeline->then()
#10 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\\Bus\\Dispatcher->dispatchNow()
#11 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\\Queue\\CallQueuedHandler->Illuminate\\Queue\\{closure}()
#12 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}()
#13 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\\Pipeline\\Pipeline->then()
#14 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\\Queue\\CallQueuedHandler->dispatchThroughMiddleware()
#15 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\\Queue\\CallQueuedHandler->call()
#16 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(439): Illuminate\\Queue\\Jobs\\Job->fire()
#17 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(389): Illuminate\\Queue\\Worker->process()
#18 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(333): Illuminate\\Queue\\Worker->runJob()
#19 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(139): Illuminate\\Queue\\Worker->runNextJob()
#20 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(122): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#21 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#22 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#23 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#24 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod()
#25 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call()
#26 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Console/Command.php(212): Illuminate\\Container\\Container->call()
#27 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/symfony/console/Command/Command.php(279): Illuminate\\Console\\Command->execute()
#28 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run()
#29 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/symfony/console/Application.php(1049): Illuminate\\Console\\Command->run()
#30 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/symfony/console/Application.php(318): Symfony\\Component\\Console\\Application->doRunCommand()
#31 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/symfony/console/Application.php(169): Symfony\\Component\\Console\\Application->doRun()
#32 /opt/lampp/htdocs/Wingu-2.0-Backend/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Symfony\\Component\\Console\\Application->run()
#33 /opt/lampp/htdocs/Wingu-2.0-Backend/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle()

event trigger fails and throws above error:

image

.env
image

broadcasting.php file

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Broadcaster
    |--------------------------------------------------------------------------
    |
    | This option controls the default broadcaster that will be used by the
    | framework when an event needs to be broadcast. You may set this to
    | any of the connections defined in the "connections" array below.
    |
    | Supported: "reverb", "pusher", "ably", "redis", "log", "null"
    |
    */

    'default' => env('BROADCAST_CONNECTION', 'null'),

    /*
    |--------------------------------------------------------------------------
    | Broadcast Connections
    |--------------------------------------------------------------------------
    |
    | Here you may define all of the broadcast connections that will be used
    | to broadcast events to other systems or over WebSockets. Samples of
    | each available type of connection are provided inside this array.
    |
    */

    'connections' => [

        'reverb' => [
            'driver' => 'reverb',
            'key' => env('REVERB_APP_KEY'),
            'secret' => env('REVERB_APP_SECRET'),
            'app_id' => env('REVERB_APP_ID'),         
            'options' => [            
                'host' => env('REVERB_HOST'),
                'port' => env('REVERB_PORT', 443),
                'scheme' => env('REVERB_SCHEME', 'https'),
                'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
        ],

        

        'ably' => [
            'driver' => 'ably',
            'key' => env('ABLY_KEY'),
        ],

        'log' => [
            'driver' => 'log',
        ],

        'null' => [
            'driver' => 'null',
        ],

    ],

];

reverb.php config file

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Reverb Server
    |--------------------------------------------------------------------------
    |
    | This option controls the default server used by Reverb to handle
    | incoming messages as well as broadcasting message to all your
    | connected clients. At this time only "reverb" is supported.
    |
    */

    'default' => env('REVERB_SERVER', 'reverb'),

    /*
    |--------------------------------------------------------------------------
    | Reverb Servers
    |--------------------------------------------------------------------------
    |
    | Here you may define details for each of the supported Reverb servers.
    | Each server has its own configuration options that are defined in
    | the array below. You should ensure all the options are present.
    |
    */

    'servers' => [

        'reverb' => [
            'host' => env('REVERB_SERVER_HOST', '0.0.0.0'),
            'port' => env('REVERB_SERVER_PORT', 8080),
            'hostname' => env('REVERB_HOST'),
            'options' => [
                'tls' => [],
            ],
            'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000),
            'scaling' => [
                'enabled' => env('REVERB_SCALING_ENABLED', false),
                'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'),
            ],
            'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15),
        ],

    ],

    /*
    |--------------------------------------------------------------------------
    | Reverb Applications
    |--------------------------------------------------------------------------
    |
    | Here you may define how Reverb applications are managed. If you choose
    | to use the "config" provider, you may define an array of apps which
    | your server will support, including their connection credentials.
    |
    */

    'apps' => [

        'provider' => 'config',

        'apps' => [
            [
                'key' => env('REVERB_APP_KEY'),
                'secret' => env('REVERB_APP_SECRET'),
                'app_id' => env('REVERB_APP_ID'),
                'options' => [
                    'host' => env('REVERB_HOST'),
                    'port' => env('REVERB_PORT', 443),
                    'scheme' => env('REVERB_SCHEME', 'https'),
                    'useTLS' => env('REVERB_SCHEME', 'https') === 'https',
                ],
                'allowed_origins' => ['*'],
                'ping_interval' => env('REVERB_APP_PING_INTERVAL', 60),
                'max_message_size' => env('REVERB_APP_MAX_MESSAGE_SIZE', 10_000),
            ],
        ],

    ],

];

Steps To Reproduce

  1. New laravel app: composer create-project laravel/laravel:^11.0 example-app
  2. Install reverb: php artisan install:broadcasting
  3. run reverb
  4. create an event
  5. trigger an event

Reverb Messages Events don't get listened to when using Herd Pro

Reverb Version

1.0.0-beta3

Laravel Version

11.0.6

PHP Version

8.3.3

Description

When using Laravel Reverb via Herd Pro, the MessageReceived & MessageSent don't get listened to by the sites within Herd Pro. This then has a knock on effect when using Laravel Pulse locally to see how many messages are sent.

Running Laravel Reverb within the project folder/site fixes the issue.

Apologies in advance if this is the wrong location for the issue

Steps To Reproduce

  • Create a new Laravel project with broadcasting enabled w/ Reverb
  • Install Laravel Pulse & run work and check
  • Start Laravel Reverb via Herd
  • Send a broadcast message

local & reverse proxied /app path returns 404

Reverb Version

1.0

Laravel Version

11.0

PHP Version

8.2.7

Description

idk if this is a bug or something wrong with the config, but reverb returns 404 when trying to connect locally or through caddy, i haven’t tried reverse proxying it through Nginx, guessing it wouldn’t of worked either because it returned 404 locally

reverb.php
IMG_8881
caddy
IMG_8884
.env
IMG_8886
IMG_8885
firefox
IMG_8890
postman
IMG_8889

Steps To Reproduce

connecting returns 404

Undefined constant "Laravel\Reverb\Servers\Reverb\Console\Commands\SIGINT"

Reverb Version

v1.0.0-beta2

Laravel Version

10.48.2

PHP Version

8.2.12

Description

Running reverb on laravel 10 on windows 10

Steps To Reproduce

New laravel 10 app

composer create-project --prefer-dist laravel/laravel laravel10-reverb "10.*"
cd laravel10-reverb

Add reverb

composer require laravel/reverb:@beta

Install reverb (in this step console still waiting, need to press enter or something)

php artisan reverb:install

Start reverb

php artisan reverb:start

image

Missing 'data' property in 'pusher_internal:subscription_succeeded' event

Reverb Version

1.0.0-beta4

Laravel Version

11.1.1

PHP Version

8.3.4

Description

Hello!

This issue targets missing data property in pusher_internal:subscription_succeeded event, in response to connecting to private or public channel.

Overview

Official Pusher server provides following payload for previously mentioned event:

{
  "event": "pusher_internal:subscription_succeeded",
  "data": "{}",
  "channel": "my-channel"
}

This can be easily verfied with JavaScript example after creating sandbox app in Pusher.

Laravel Reverb does not send data property for such event:

{
  "event": "pusher_internal:subscription_succeeded",
  "channel": "my-channel"
}

For JavaScript Pusher-compatible clients it's irrelevant as these can gracefully handle missing property. However, using Laravel Reverb as Pusher server for mobile application on iOS platform - written in Flutter and using forked official Pusher package (https://pub.dev/packages/pusher_channels_flutter) to allow server details customization - makes websocket unusable for apps that rely on that event, as Pusher Swift implementation does not properly parse payload and does not emit subscription_succeeded, which makes it impossible to react for such event.

Solving problem

To make data property available in event payload we could simply remove empty($data) condition in EventHandler::formatPayload method and assign result of JSON encoding directly to that property, as following:

return json_encode(
            array_filter([
                'event' => $prefix.$event,
                'data' => json_encode($data),
                'channel' => $channel,
            ])
        );

But this solution will result in payload containing data: '[]'. To be fully compatible with Pusher official server I suggest to modify mentioned condition and return string '{}' instead of null for empty data, and encoded JSON for other cases.

I've prepared PR for this solution.

Best regards!

Steps To Reproduce

Very basic Laravel application with installed Reverb and JavaScript Echo connecting to websocket channel will provide described results.

Custom driver

Can you tell me where to add a custom driver?

Adding this to my AppServiceProvider is not working as I would expect.

public function register(): void
{
    app(ApplicationManager::class)->extend('custom', function() {
        // return my custom ApplicationProvider
    });

}

Starting reverb with php artisan reverb:start returns the exception:
Driver [cutom] not supported.

Show more information from reverb server with --debug

It would be great if --debug also showed more details, for example when something besides 200 OK happends it would be great to have more details than "internal server error", it would also help when doing bug issues.

Kind regards

Wrong calculation user_count on presence channels

Reverb Version

1.x

Laravel Version

11

PHP Version

8.3

Description

1. user_count on get channels request

$pusher->getChannels(['filter_by_prefix' => 'presence-', 'info' => 'user_count']); return wrong number for user_count.

If we check Pusher documentation we will see - user_count is number of distinct users currently subscribed to this channel (a single user may be subscribed many times, but will only count as one). So user_count must return only unique users count, not connections count.

2. users list on get presence users request

$pusher->getPresenceUsers('presence-channel-id'); return wrong list of users with duplicates for each connection. If we check Pusher documentation - fetch user IDs of user currently subscribed to a presence channel. Here must be only unique users, not connections.

Steps To Reproduce

  1. Run $pusher->getChannels(['filter_by_prefix' => 'presence-', 'info' => 'user_count']);.
  2. Run $pusher->getPresenceUsers('presence-channel-id');.

PusherBroadcaster 404 Error on Production Server

Reverb Version

1.x

Laravel Version

11.0.7

PHP Version

8.2

Description

First, I already have a fully working reverb websocket connection when developing locally - Private-Channels, Authentication, Notifications, SSL - everything works like a charm. My frontend is a seperate angular-application running on a different subdomain.

On my production server the websocket connection is also established as it should be. BUT when firing a notification that should be broadcasted via reverb, the queued job fails with the following error:

Illuminate\Broadcasting\BroadcastException: Pusher error: <!DOCTYPE html>
<html lang="en">
    // some html that says 404 not found
</html>

. in /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Broadcasting/Broadcasters/PusherBroadcaster.php:164
Stack trace:
#0 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Broadcasting/BroadcastEvent.php(92): Illuminate\Broadcasting\Broadcasters\PusherBroadcaster->broadcast()
#1 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Broadcasting\BroadcastEvent->handle()
#2 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#3 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#4 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#5 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#6 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()
#7 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#8 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#9 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#10 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\Bus\Dispatcher->dispatchNow()
#11 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()
#12 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#13 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then()
#14 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#15 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\Queue\CallQueuedHandler->call()
#16 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(439): Illuminate\Queue\Jobs\Job->fire()
#17 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(389): Illuminate\Queue\Worker->process()
#18 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(176): Illuminate\Queue\Worker->runJob()
#19 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(139): Illuminate\Queue\Worker->daemon()
#20 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(122): Illuminate\Queue\Console\WorkCommand->runWorker()
#21 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#22 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#23 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#24 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod()
#25 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#26 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(212): Illuminate\Container\Container->call()
#27 /var/www/vhosts/example.com/api.example.com/vendor/symfony/console/Command/Command.php(279): Illuminate\Console\Command->execute()
#28 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run()
#29 /var/www/vhosts/example.com/api.example.com/vendor/symfony/console/Application.php(1049): Illuminate\Console\Command->run()
#30 /var/www/vhosts/example.com/api.example.com/vendor/symfony/console/Application.php(318): Symfony\Component\Console\Application->doRunCommand()
#31 /var/www/vhosts/example.com/api.example.com/vendor/symfony/console/Application.php(169): Symfony\Component\Console\Application->doRun()
#32 /var/www/vhosts/example.com/api.example.com/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(196): Symfony\Component\Console\Application->run()
#33 /var/www/vhosts/example.com/api.example.com/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#34 {main}

I already thought of a problem in the .env file - but I could not find a solution so far...

REVERB_APP_ID=app_id
REVERB_APP_KEY=app_key
REVERB_APP_SECRET=app_secret
REVERB_HOST=subdomain-of-my-laravel-backend.example.com // also tried with localhost and frontend-subdomain
REVERB_PORT=443 // this is also the default value in the config/reverb.php 
REVERB_SCHEME=https

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

Steps To Reproduce

sorry for missing out that

Run standalone, outside of application

We run our application on Laravel Vapor, and currently run socketi on ECS for pusher websockets.
Is there the option to run reverb standalone, without dependance on the app's code (ie, installing it into the laravel application)?

Thanks!

Laravel reverb config tls variables

In my dev I'm using a self signed certificate, so I have to put the cert path in .env.
In my production there's a nginx reverse proxy, so I don't need a certificate in my .env.

But the problem is if the options "tls" is NOT empty then the server will run in secure mode.

Servers/Reverb/Factory.php L54

$uri = empty($options['tls']) ? "{$host}:{$port}" : "tls://{$host}:{$port}";

My reverb.php config

'servers' => [
        'reverb' => [
           ...
            'options' => [
                'tls' => [ //tls is ALWAYS not empty
                    'local_cert' =>env('REVERB_CERT')
                ],
            ],
        ]
]

Subscription to private channel from Next.js using Laravel Breeze doesn't work. I keep getting unauthorized error

Reverb Version

@beta

Laravel Version

11.0

PHP Version

8.3

Description

I keep getting this:
image

Browser error
image

Subscribing to the private channel:
image

The echo configuration:
image

channel creation
image

I have added this to the api/routes file:
Broadcast::routes(['middleware' => ['auth:sanctum']]);

and when I log auth and data in this file i get null . Logged in user details doesn't reach this point :

image

Steps To Reproduce

Install Next.js
install Laravel Breeze - Next.js Edition https://github.com/laravel/breeze-next

install Echo

configure echo tu use reverb

subscribe to private channel

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

...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.