laravel-websockets

Laravel WebScokets
Git hub: laravel-websockets
Official Document: laravel-websockets

– Drop-in Pusher replacement, SSL support, Laravel Echo support and a debug dashboard are just some of its features.

### How to use
https://docs.beyondco.de/laravel-websockets/1.0/getting-started/introduction.html

### package install
$ php composer.phar require beyondcode/laravel-websockets

### publish migration file
$ php artisan vendor:publish –provider=”BeyondCode\LaravelWebSockets\WebSocketsServiceProvider” –tag=”migrations”
Copied File [/vendor/beyondcode/laravel-websockets/database/migrations/create_websockets_statistics_entries_table.php.stub] To [/database/migrations/2020_02_07_062321_create_websockets_statistics_entries_table.php]

$ php artisan migrate
+——————————-+
| Tables_in_chat |
+——————————-+
| failed_jobs |
| messages |
| migrations |
| password_resets |
| users |
| websockets_statistics_entries |
+——————————-+

mysql> describe websockets_statistics_entries;
+————————-+——————+——+—–+———+—————-+
| Field | Type | Null | Key | Default | Extra |
+————————-+——————+——+—–+———+—————-+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| app_id | varchar(255) | NO | | NULL | |
| peak_connection_count | int(11) | NO | | NULL | |
| websocket_message_count | int(11) | NO | | NULL | |
| api_message_count | int(11) | NO | | NULL | |
| created_at | timestamp | YES | | NULL | |
| updated_at | timestamp | YES | | NULL | |
+————————-+——————+——+—–+———+—————-+
※アクセス情報が保存される

### Websocket Configuration File
$ php artisan vendor:publish –provider=”BeyondCode\LaravelWebSockets\WebSocketsServiceProvider” –tag=”config”
Copied File [/vendor/beyondcode/laravel-websockets/config/websockets.php] To [/config/websockets.php]

### config/broadcasting.php

'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' => '192.168.33.10', // ご自身のホスト名
                'port' => 6001,
                'scheme' => 'http' // or https
            ],
        ],

### .env

PUSHER_APP_ID=1
PUSHER_APP_KEY=laravelWebsockets
PUSHER_APP_SECRET=laravelWebsockets
PUSHER_APP_CLUSTER=ap1

$ php artisan serve –host 192.168.33.10 –port 8000
$ php artisan websockets:serve
Starting the WebSocket server on port 6001…

app.js:28574 WebSocket connection to ‘wss://192.168.33.10/app/laravelWebsockets?protocol=7&client=js&version=5.0.3&flash=false’ failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED

何故だ。。。