正在显示
4 个修改的文件
包含
52 行增加
和
14 行删除
app/Events/WebSocketMessage.php~HEAD
0 → 100644
| 1 | +<?php | ||
| 2 | + | ||
| 3 | +namespace App\Events; | ||
| 4 | + | ||
| 5 | +use Illuminate\Broadcasting\Channel; | ||
| 6 | +use Illuminate\Broadcasting\InteractsWithSockets; | ||
| 7 | +use Illuminate\Broadcasting\PresenceChannel; | ||
| 8 | +use Illuminate\Broadcasting\PrivateChannel; | ||
| 9 | +use Illuminate\Contracts\Broadcasting\ShouldBroadcast; | ||
| 10 | +use Illuminate\Foundation\Events\Dispatchable; | ||
| 11 | +use Illuminate\Queue\SerializesModels; | ||
| 12 | + | ||
| 13 | +class WebSocketMessage | ||
| 14 | +{ | ||
| 15 | + use Dispatchable, InteractsWithSockets, SerializesModels; | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * Create a new event instance. | ||
| 19 | + * | ||
| 20 | + * @return void | ||
| 21 | + */ | ||
| 22 | + public function __construct() | ||
| 23 | + { | ||
| 24 | + // | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * Get the channels the event should broadcast on. | ||
| 29 | + * | ||
| 30 | + * @return \Illuminate\Broadcasting\Channel|array | ||
| 31 | + */ | ||
| 32 | + public function broadcastOn() | ||
| 33 | + { | ||
| 34 | + return new PrivateChannel('channel-name'); | ||
| 35 | + } | ||
| 36 | +} |
| @@ -5,7 +5,6 @@ | @@ -5,7 +5,6 @@ | ||
| 5 | "keywords": ["framework", "laravel"], | 5 | "keywords": ["framework", "laravel"], |
| 6 | "license": "MIT", | 6 | "license": "MIT", |
| 7 | "require": { | 7 | "require": { |
| 8 | - i | ||
| 9 | "bensampo/laravel-enum": "^4.2", | 8 | "bensampo/laravel-enum": "^4.2", |
| 10 | "beyondcode/laravel-websockets": "^1.14", | 9 | "beyondcode/laravel-websockets": "^1.14", |
| 11 | "doctrine/dbal": "^3.6", | 10 | "doctrine/dbal": "^3.6", |
| @@ -15,7 +15,7 @@ return [ | @@ -15,7 +15,7 @@ return [ | ||
| 15 | | | 15 | | |
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | - 'default' => env('BROADCAST_DRIVER', 'null'), | 18 | + 'default' => env('BROADCAST_DRIVER', 'swoole'), |
| 19 | 19 | ||
| 20 | /* | 20 | /* |
| 21 | |-------------------------------------------------------------------------- | 21 | |-------------------------------------------------------------------------- |
| @@ -29,21 +29,20 @@ return [ | @@ -29,21 +29,20 @@ return [ | ||
| 29 | */ | 29 | */ |
| 30 | 30 | ||
| 31 | 'connections' => [ | 31 | 'connections' => [ |
| 32 | + 'pusher' => [ | ||
| 33 | + 'driver' => 'pusher', | ||
| 34 | + 'key' => env('PUSHER_APP_KEY'), | ||
| 35 | + 'secret' => env('PUSHER_APP_SECRET'), | ||
| 36 | + 'app_id' => env('PUSHER_APP_ID'), | ||
| 37 | + 'options' => [ | ||
| 38 | + 'cluster' => env('PUSHER_APP_CLUSTER'), | ||
| 39 | + 'useTLS' => true, | ||
| 40 | + ], | ||
| 41 | + ], | ||
| 32 | 'swoole' => [ | 42 | 'swoole' => [ |
| 33 | 'driver' => 'swoole', | 43 | 'driver' => 'swoole', |
| 34 | 'queue' => 'default', // 队列名 | 44 | 'queue' => 'default', // 队列名 |
| 35 | ], | 45 | ], |
| 36 | - 'pusher' => [ | ||
| 37 | - 'driver' => 'pusher', | ||
| 38 | - 'key' => env('PUSHER_APP_KEY'), | ||
| 39 | - 'secret' => env('PUSHER_APP_SECRET'), | ||
| 40 | - 'app_id' => env('PUSHER_APP_ID'), | ||
| 41 | - 'options' => [ | ||
| 42 | - 'cluster' => env('PUSHER_APP_CLUSTER'), | ||
| 43 | - 'useTLS' => true, | ||
| 44 | - ], | ||
| 45 | - ], | ||
| 46 | - | ||
| 47 | 'ably' => [ | 46 | 'ably' => [ |
| 48 | 'driver' => 'ably', | 47 | 'driver' => 'ably', |
| 49 | 'key' => env('ABLY_KEY'), | 48 | 'key' => env('ABLY_KEY'), |
| @@ -60,7 +60,11 @@ return [ | @@ -60,7 +60,11 @@ return [ | ||
| 60 | 'via' => \App\Factory\LogFormatterFactory::class, | 60 | 'via' => \App\Factory\LogFormatterFactory::class, |
| 61 | 'prefix' => 'bside', | 61 | 'prefix' => 'bside', |
| 62 | ], | 62 | ], |
| 63 | - | 63 | + 'wechatside' => [ |
| 64 | + 'driver' => 'custom', | ||
| 65 | + 'via' => \App\Factory\LogFormatterFactory::class, | ||
| 66 | + 'prefix' => 'wechatside', | ||
| 67 | + ], | ||
| 64 | 'stack' => [ | 68 | 'stack' => [ |
| 65 | 'driver' => 'stack', | 69 | 'driver' => 'stack', |
| 66 | 'channels' => ['single'], | 70 | 'channels' => ['single'], |
-
请 注册 或 登录 后发表评论