Home

Awesome

Messenger UI

Latest Version on Packagist Total Downloads StyleCI License


Preview


Ready-made UI and web routes for use with rtippin/messenger

Notes


Installation

Via Composer

composer require rtippin/messenger-ui

Publish Assets and Config

php artisan messenger:ui:publish
php artisan vendor:publish --tag=messenger-ui.assets --force

Config

Default:

'site_name' => env('MESSENGER_SITE_NAME', 'Messenger'),

'websocket' => [
    'pusher' => env('MESSENGER_SOCKET_PUSHER', false),
    'host' => env('MESSENGER_SOCKET_HOST', 'localhost'),
    'auth_endpoint' => env('MESSENGER_SOCKET_AUTH_ENDPOINT', '/api/broadcasting/auth'),
    'key' => env('MESSENGER_SOCKET_KEY'),
    'port' => env('MESSENGER_SOCKET_PORT', 6001),
    'use_tsl' => env('MESSENGER_SOCKET_TLS', false),
    'cluster' => env('MESSENGER_SOCKET_CLUSTER'),
],

'routing' => [
    'domain' => null,
    'prefix' => 'messenger',
    'middleware' => ['web', 'auth', 'messenger.provider'],
    'invite_middleware' => ['web', 'messenger.provider'],
],

Using Pusher

composer require pusher/pusher-php-server

Default broadcasting.php config

'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'),
        'useTLS' => false,
    ],
], 

.env keys for both pusher and our UI

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=YourPusherId
PUSHER_APP_KEY=YourPusherKey
PUSHER_APP_SECRET=YourPusherSecret
PUSHER_APP_CLUSTER=YourPusherCluster
MESSENGER_SOCKET_PUSHER=true
MESSENGER_SOCKET_KEY="${PUSHER_APP_KEY}"
MESSENGER_SOCKET_CLUSTER="${PUSHER_APP_CLUSTER}"

Using laravel-websockets

composer require beyondcode/laravel-websockets "^1.12"

Updated broadcasting.php config per beyondcode's documentation

'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'),
        'encrypted' => true,
        'host' => 'localhost',
        'port' => 6001,
        'scheme' => 'http'
    ],
],

.env keys for both laravel-websockets and our UI

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=MakeYourID
PUSHER_APP_KEY=MakeYourKey
PUSHER_APP_SECRET=MakeYourSecret
MESSENGER_SOCKET_HOST=localhost
MESSENGER_SOCKET_KEY="${PUSHER_APP_KEY}"