From 1728006c7507dc973e684e0b03040304fa05e08a Mon Sep 17 00:00:00 2001
From: GuLiMmo <2820890765@qq.com>
Date: Tue, 27 Aug 2024 17:03:32 +0800
Subject: [PATCH] chore:接入新框架api
---
src/mqtt/config.ts | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/mqtt/config.ts b/src/mqtt/config.ts
index c3acd5b..44edae5 100644
--- a/src/mqtt/config.ts
+++ b/src/mqtt/config.ts
@@ -1,8 +1,13 @@
-import {
- IClientOptions,
-} from 'mqtt'
-
-const { mqttConfig: { clientId, username, password, host, protocol, port } } = window.globalApiConfig
+/*
+ * @Author: GuLiMmo 2820890765@qq.com
+ * @Date: 2024-03-12 18:01:28
+ * @LastEditors: GuLiMmo 2820890765@qq.com
+ * @LastEditTime: 2024-08-27 16:17:01
+ * @FilePath: /drone-web/src/mqtt/config.ts
+ * @Description: mqtt配置
+ * Copyright (c) 2024 by GuLiMmo, All Rights Reserved.
+ */
+import { IClientOptions } from 'mqtt'
export const OPTIONS: IClientOptions = {
clean: true, // true: 清除会话, false: 保留会话
@@ -10,10 +15,11 @@
resubscribe: true, // 断开重连后,再次订阅原订阅
reconnectPeriod: 10000, // 重连间隔时间: 5s
keepalive: 5, // 心跳间隔时间:1s
- clientId: clientId || 'DroneWeb',
- username: username || 'root',
- password: password || 'root',
- host: host || '139.196.74.78',
- protocol: protocol || 'ws',
- port: port || 8083,
+ clientId: window?.globalApiConfig?.mqttConfig?.clientId || 'DroneWeb',
+ username: window?.globalApiConfig?.mqttConfig?.username || 'root',
+ password: window?.globalApiConfig?.mqttConfig?.password || 'root',
+ host: window?.globalApiConfig?.mqttConfig?.host || '139.196.74.78',
+ protocol: window?.globalApiConfig?.mqttConfig?.protocol || 'wss',
+ // 8083
+ port: window?.globalApiConfig?.mqttConfig?.port || 8084,
}
--
Gitblit v1.9.3