Laravel Websocket A Replacement Package For Socket.io

A few notes on the implementation of laravel-websocket from local to deployment. A reminder to myself that this package will replace pusher and will have my own “pusher” service.

Here are the gists:

...

'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),
                'host' => '127.0.0.1',
                'port' => env('PUSHER_APP_PORT', 6001),
                'scheme' => 'http'
            ],
        ],

...
  • On the websockets.php
    Change config to use env config to be more flexible
  • On the echo.js file
    • Set encrypted to true because we are connecting through https.
...
encrypted: true,
...
    • Set the enabledTransports so that it won’t connect to pusher.com’s service. A 3rd party service.
...
enabledTransports: ['ws', 'wss'],
...

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s