作者 张关杰

gx

<?php
namespace App\Events;
use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class WebSocketMessage
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Get the channels the event should broadcast on.
*
* @return \Illuminate\Broadcasting\Channel|array
*/
public function broadcastOn()
{
return new PrivateChannel('channel-name');
}
}
... ...
... ... @@ -5,7 +5,6 @@
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
i
"bensampo/laravel-enum": "^4.2",
"beyondcode/laravel-websockets": "^1.14",
"doctrine/dbal": "^3.6",
... ...
... ... @@ -15,7 +15,7 @@ return [
|
*/
'default' => env('BROADCAST_DRIVER', 'null'),
'default' => env('BROADCAST_DRIVER', 'swoole'),
/*
|--------------------------------------------------------------------------
... ... @@ -29,21 +29,20 @@ return [
*/
'connections' => [
'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' => true,
],
],
'swoole' => [
'driver' => 'swoole',
'queue' => 'default', // 队列名
],
'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' => true,
],
],
'ably' => [
'driver' => 'ably',
'key' => env('ABLY_KEY'),
... ...
... ... @@ -60,7 +60,11 @@ return [
'via' => \App\Factory\LogFormatterFactory::class,
'prefix' => 'bside',
],
'wechatside' => [
'driver' => 'custom',
'via' => \App\Factory\LogFormatterFactory::class,
'prefix' => 'wechatside',
],
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
... ...