Download the PHP package kanata-php/conveyor-laravel-broadcaster without Composer
On this page you can find all versions of the php package kanata-php/conveyor-laravel-broadcaster. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kanata-php/conveyor-laravel-broadcaster
More information about kanata-php/conveyor-laravel-broadcaster
Files in kanata-php/conveyor-laravel-broadcaster
Package conveyor-laravel-broadcaster
Short Description Conveyor Laravel Broadcaster
License
Informations about the package conveyor-laravel-broadcaster
Conveyor Laravel Broadcaster
This is a Laravel Integration for Socket Conveyor. It allows you to use the Conveyor WebSocket server as a broadcasting driver for Laravel. This package needs Jacked Server.
This package is an alternative for those who want to use Conveyor as a broadcasting driver. For that, you need to install Jacked Server or check there how to run your WebSocket server with Conveyor
Installation
Start by installing Jacked Server.
Step 1: Install the package via composer:
Step 2: Publish the configuration:
Step 3: Add Service Provider to the config/app.php
file:
Step 4: If on Laravel 11, enable Laravel broadcasting:
Step 5: Add the following to your config/broadcasting.php
file:
Step 6: Protect your channel with a "channel route" (a specific laravel detail). You do this by adding the following to your routes/channels.php
:
Step 7: This package require an user to authenticate with. To quickly create a user, you can use tinker for that:
Within tinker, you can create a user:
Step 8: Specify the configurations for the WebSocket server in the .env
file:
Important: SQLite won't work well due to its lock mechanism and how concurrency happens with this service. It is recommended to use MySQL, Postgres, or a more robust database.
At this point you can broadcast from your Laravel instance to the Conveyor WebSocket server. To understand how to broadcast with Laravel, visit Broadcasting.
Step 9: Install the Conveyor JS Client:
Important: Don't forget to run
npm run build
!
Add this to the bootstrap.js file of your Laravel app so the Conveyor client is available globally:
Remember to run npm install
and npm run dev
or npm run prod
to compile the assets.
Info: If you want to send one-off messages to the Conveyor WebSocket server, you can just dispatch an event like follows:
Important: notice that we are using
ShouldBroadcastNow
instead ofShouldBroadcast
. Conveyor doesn't need queueing and is much faster this way. If you want, you can still use queues.
Example of usage in a view with authorization at this point:
Then, add the route for this view at your routes/web.php
file: