This Laravel Websocket by freak and Marcille.This package you can say Beyondcode.This package is similar to pusher but pusher is paid service and this package is not paid yes guys you can freely use this package without paying anything. This package removes the use of pusher real-time systems and this package allows you to use a real-time system on your project or your app.

laravel-websockets without pusher

I received mail how to setup WebSocket configuration into laravel so I decided to make one blog for especially laravel  WebSocket configuration setup only, This WebSocket service is free service it is like pusher service but pusher service is paid and this package is freely used into laravel framework

you need to follow some configuration steps for WebSocket service

Step 1:install WebSocket

composer require beyondcode/laravel-websockets

Step 2:Apply command once install WebSocket successfully

php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="migrations"

Step 3:Run migration

php artisan migrate

Step 4: publish WebSocket configuation

php artisan vendor:publish --provider="BeyondCode\LaravelWebSockets\WebSocketsServiceProvider" --tag="config"

Step 5: check setup config folder websockets.php

  'apps' => [


            'id' => env('PUSHER_APP_ID'),

            'name' => env('APP_NAME'),

            'key' => env('PUSHER_APP_KEY'),

            'secret' => env('PUSHER_APP_SECRET'),

            'path' => env('PUSHER_APP_PATH'),

            'capacity' => null,

            'enable_client_messages' => true,

            'enable_statistics' => true,



Step 6: install pusher

To make use WebSockets package of laravel with combination of pusher you can need to install pusher first

composer require pusher/pusher-php-server "~3.0"

Step 7: setup broadcast driver .env file

You need to use pusher as broadcasting driver into laravel so below line setup into .env file

& don't forget to uncomment below line on app.php  that is not defined into documentation

Step 8: Now setup pusher configuration  into config/broadcasting.php file in connections array

'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => 'ap2',
                'encrypted' => false,
                'host' => '',
                'port' => 6001,
                'scheme' => 'http'

Step 9: When using Laravel WebSockets in combination with a custom SSL certificate, be sure to use the encrypted option and set it to true.

import Echo from 'laravel-echo'

window.Pusher = require('pusher-js');

window.Echo = new Echo({
    broadcaster: 'pusher',
    key: "your key here",
    cluster: "ap2",
    wsHost: window.location.hostname,
    wsPort: 6001,
    disableStats: true,

Step 10: you can use this all API key, secret key app name app cluster into .env file

PUSHER_APP_ID=your app id
PUSHER_APP_KEY=your app key 
PUSHER_APP_SECRET=your secret key of app

Step 11:checking WebSocket how to run?

php artisan serve then
php artisan websocket:serve

write URL because into websockets.php of config folder you can check the value of path

     * This path will be used to register the necessary routes for the package.
    'path' => 'laravel-websockets'

You can change and check it also, It will work definitely.


Click on connect and check output like this

laravel-websockets tutorial

you can create app of pusher credentials from here

For More advance usage information check here laravel-websockets without pusher

I hope this configuration steps of WebSocket will help you to start WebSocket serve into laravel successfully

Thank you.


  1. How to make WebSockets WITHOUT PUSHER. Step 6 - install pusher... Unbelievable

    1. It is pusher replacement that's why only pusher installation needed in laravel you can read here for more information -

    2. ha ha, you are the best, man! I wanted to leave the same comment!


Post a Comment

Previous Post Next Post