123456789101112131415161718192021222324252627282930313233343536 |
- <?php
- declare(strict_types=1);
- /**
- * This file is part of Hyperf.
- *
- * @link https://www.hyperf.io
- * @document https://hyperf.wiki
- * @contact group@hyperf.io
- * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
- */
- use function Hyperf\Support\env;
- return [
- 'client' => [
- 'host' => env('MQTT_CLIENT_HOST', '127.0.0.1'),
- 'port' => (int)env('MQTT_CLIENT_PORT', 1883),
- 'pool' => [
- 'userName' => env('MQTT_CLIENT_USERNAME', ''),
- 'password' => env('MQTT_CLIENT_PASSWORD', ''),
- 'clientId' => env('MQTT_CLIENT_CLIENT_ID', 'hyperf'), // 客户端id
- 'keepAlive' => 60, // 心跳 默认0秒,设置成0代表禁用
- 'protocolName' => 'MQTT', // 协议名,默认为MQTT(3.1.1版本),也可为MQIsdp(3.1版本)
- 'protocolLevel' => 4, // 协议等级,MQTT3.1.1版本为4,5.0版本为5,MQIsdp为3
- 'properties' => [], // MQTT5 中所需要的属性
- 'delay' => 3000, // 重连时的延迟时间 (毫秒)
- 'maxAttempts' => 5, // 最大重连次数。默认-1,表示不限制
- 'swooleConfig' => [
- 'open_mqtt_protocol' => true,
- 'package_max_length' => 2 * 1024 * 1024
- ]
- ],
- ],
- ];
|