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 doesn't need Jacked Server, but just know that that web server is great!
This package allows the usage of Conveyor as a broadcasting driver in Laravel.
To understand how to broadcast with Laravel, visit Broadcasting.
Quick Start
Table of Contents
- Step 1: Install the package via composer
- Step 2: Publish the configuration
- Step 3: Add Service Provider
- Step 4: Enable Laravel broadcasting
- Step 5: Add broadcasting config
- Step 6: Migrate the database
- Step 7: Install the Conveyor JS Client
- Extra: Simple Conveyor Server for this example
Step 1: Install the package via composer
Step 2: Publish the configuration
Step 3: Add Service Provider
Laravel 10 backwards:
Laravel 11 onwards:
Step 4: Enable Laravel broadcasting
This is for Laravel 11 and forward, if in any other version just skip this step!
Step 5: Add broadcasting config
Add the following to your config/broadcasting.php
file:
Step 6: Set configuration
Set the configurations for the WebSocket server in the .env
file:
CONVEYOR_QUERY
is the url query where we add the token you set to protect your WebSocket server.
Step 7: 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:
Extra: Simple Conveyor Server for this example
You can use this simple server to test your broadcasting (and in production...):
Remember to install conveyor with composer require kanata-php/conveyor
and run the server with php server.php
.