https://dashboard.pusher.com
首先 pusher官網註冊帳號 而且選擇操做服務 由於我習慣性用vue可是沒有 前端就選js 後端固然是laravel php
而後 前往packalyst下載並配置pusher
https://packalyst.com/package...前端
$ composer require pusher/pusher-http-laravel
config/app.php to your aliasesvue
'Pusher' => Pusher\Laravel\Facades\Pusher::class
config/app.php in the providerslaravel
Pusher\Laravel\PusherServiceProvider::class
而後就會在config文件下出現pusher文件後端
具體配置app
'connections' => [ 'main' => [ 'auth_key' => env('PUSHER_APP_KEY'), 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ 'cluster' => 'ap1', 'encrypted' => true ], 'host' => null, 'port' => null, 'timeout' => null, ], 'alternative' => [ 'auth_key' => 'your-auth-key', 'secret' => 'your-secret', 'app_id' => 'your-app-id', 'options' => [], 'host' => null, 'port' => null, 'timeout' => null, ], ], ];
由於我將從pusher註冊的key配置寫在了env裏 你也能夠直接寫進去
env配置composer
PUSHER_APP_ID=489720 PUSHER_APP_KEY=be59d501087a3c4a340d PUSHER_APP_SECRET=661f0c7f0dd0ecd86c11 PUSHER_APP_CLUSTER=ap1
這樣就基本配置完畢
去路由激活它ide
Route::get('pusher/index','PusherController@index');
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; class PusherController extends Controller { // function index(){ $pusher=app()->make('pusher'); $pusher->trigger('wang-channel','ye-event',['message'=>'woshiwangye']); return view('pusher/index'); } }
這樣每次訪問路由上的地址 官網都會出現監控信息ui
基本配置已經結束spa