123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- <?php
- declare(strict_types=1);
- /**
- * This file is part of Panda.
- *
- * @link https://www.yangertao.com
- * @contact joeyoung0314@qq.com
- * @license https://github.com/nashgao/mqtt-client
- */
- use function Hyperf\Support\env;
- return [
- 'default' => [
- 'host' => env('MQTT_CLIENT_HOST', 'localhost'),
- 'port' => env('MQTT_CLIENT_PORT', 1883),
- // http port option deprecated
- 'http_port' => env('MQTT_CLIENT_HTTP_PORT', 8081),
- 'time_out' => env('MQTT_CLIENT_TIMEOUT', 10),
- 'keepalive' => env('MQTT_CLIENT_KEEPALIVE', 60),
- 'protocol_name' => 'MQTT',
- 'protocol_level' => env('MQTT_CLIENT_PROTOCOL_LEVEL', 5),
- 'username' => env('MQTT_CLIENT_USERNAME', 'admin'),
- 'password' => env('MQTT_CLIENT_PASSWORD', 'public'),
- 'clean_session' => false,
- 'will' => [], // template: ['topic' => $topic, 'message' => 'bye']
- 'properties' => [
- ],
- 'swoole_config' => [
- 'package_max_length' => 1024 * 1024,
- 'connect_timeout' => 5.0,
- 'keepalive' => 0, // 默认0秒,表示禁用
- 'ssl_enabled' => false,
- 'ssl_cert_file' => '',
- 'ssl_key_file' => '',
- 'ssl_cafile' => '',
- ],
- 'http' => [
- 'host' => env('MQTT_CLIENT_HTTP_HOST', 'localhost'),
- 'port' => env('MQTT_CLIENT_HTTP_PORT', 8081),
- 'app_id' => env('MQTT_CLIENT_HTTP_APP_ID', 'admin'),
- 'app_secret' => env('MQTT_CLIENT_HTTP_APP_SECRET', 'public'),
- ],
- 'pool' => [
- 'min_connections' => 1,
- 'max_connections' => 10,
- 'connect_timeout' => 10.0,
- 'wait_timeout' => 20.0,
- 'heartbeat' => -1,
- 'max_idle_time' => 60,
- ],
- 'prefix' => env('MQTT_CLIENT_CLIENT_ID', 'hyperf'),// 前缀
- 'subscribe' => [
- 'topics' => [
- [
- 'topic' => 'abcd/device/msg',// 主题
- 'auto_subscribe' => false, // true 跟随 hyperf 服务器启动 订阅所提到的主题
- 'enable_multisub' => false,
- 'multisub_num' => 2, // 让多个订阅同一个主题,通常适用于队列主题和共享主题
- 'enable_share_topic' => false,
- 'share_topic' => [
- 'group_name' => [], // 组名列表
- ],
- 'enable_queue_topic' => false, // 队列主题具有更高的优先级,如果定义了队列主题,那么共享主题将是无用的
- 'qos' => 2,
- 'filter' => null,
- 'no_local' => true,
- 'retain_as_published' => true,
- 'retain_handling' => 2,
- ],
- ],
- ],
- 'publish' => [
- 'topics' => [
- [
- 'topic' => '+/device/msg',
- 'qos' => 2,
- 'no_local' => true,
- 'retain_as_published' => true,
- 'retain_handling' => 2,
- ],
- ],
- ],
- ],
- ];
|