Overview


Welcome to Larasockets, the best, no configuration, pay as you go broadcasting solution available for Laravel.


Requirements

Laravel >= 5.8

Install Larasocket

Include the php

composer require larasocket/larasocket-driver

Add Larasocket as a broadcasting connection option in config/broadcasting.php:

'larasocket' => [
    'driver' => 'larasocket',
    'token' => env('LARASOCKET_TOKEN'),
],

Update your .env. You can get a token by logging in.

BROADCAST_DRIVER=larasocket
LARASOCKET_TOKEN=<token>
MIX_LARASOCKET_TOKEN="${LARASOCKET_TOKEN}"

Include the javascript

npm i larasocket-js

Use the Larasocket driver in your bootstrap.js

...
import Echo from 'laravel-echo';
import Larasocket from 'larasocket-js';

window.Echo = new Echo({
    broadcaster: Larasocket,
    token: process.env.MIX_LARASOCKET_TOKEN,
});