From d185d363561ab3622ff09f83bc5f14d38498f385 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Tue, 19 Sep 2023 10:24:44 +0800
Subject: [PATCH] mqtt连接
---
src/mqtt/config.ts | 6 +++---
src/components/g-map/use-connect-mqtt.ts | 10 ++++++++++
src/api/http/config.ts | 18 ++++++++++++++----
src/mqtt/index.ts | 1 -
4 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/api/http/config.ts b/src/api/http/config.ts
index 0fa0bcd..c2d0c84 100644
--- a/src/api/http/config.ts
+++ b/src/api/http/config.ts
@@ -1,3 +1,13 @@
+/*
+ * @Author: husq 931347610@qq.com
+ * @Date: 2023-09-19 09:41:57
+ * @LastEditors: husq 931347610@qq.com
+ * @LastEditTime: 2023-09-19 10:11:42
+ * @FilePath: \Cloud-API-Demo-Web\src\api\http\config.ts
+ * @Description:
+ *
+ * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
+ */
export const CURRENT_CONFIG = {
// license
@@ -7,12 +17,12 @@
// http
// http://172.16.13.64:8100
- // baseURL: 'http://192.168.1.198:6789', // This url must end with "/". Example: 'http://192.168.1.1:6789/'
- baseURL: 'https://dev.jxpskj.com:36789', // This url must end with "/". Example: 'http://192.168.1.1:6789/'
+ baseURL: 'http://192.168.1.198:6789', // This url must end with "/". Example: 'http://192.168.1.1:6789/'
+ // baseURL: 'https://dev.jxpskj.com:36789', // This url must end with "/". Example: 'http://192.168.1.1:6789/'
// ws: 'ws//127.0.0.1:6789/api/v1/ws',
// ws://192.168.1.198:1883/
- // websocketURL: 'ws://192.168.1.198:6789/api/v1/ws', // Example: 'ws://192.168.1.198:6789/api/v1/ws'
- websocketURL: 'wss://dev.jxpskj.com:36789/api/v1/ws', // Example: 'ws://192.168.1.198:6789/api/v1/ws'
+ websocketURL: 'ws://192.168.1.198:6789/api/v1/ws', // Example: 'ws://192.168.1.198:6789/api/v1/ws'
+ // websocketURL: 'wss://dev.jxpskj.com:36789/api/v1/ws', // Example: 'ws://192.168.1.198:6789/api/v1/ws'
// livestreaming
// RTMP Note: This IP is the address of the streaming server. If you want to see livestream on web page, you need to convert the RTMP stream to WebRTC stream.
diff --git a/src/components/g-map/use-connect-mqtt.ts b/src/components/g-map/use-connect-mqtt.ts
index a032168..a6d10e8 100644
--- a/src/components/g-map/use-connect-mqtt.ts
+++ b/src/components/g-map/use-connect-mqtt.ts
@@ -1,3 +1,13 @@
+/*
+ * @Author: husq 931347610@qq.com
+ * @Date: 2023-08-22 09:55:39
+ * @LastEditors: husq 931347610@qq.com
+ * @LastEditTime: 2023-09-19 10:23:42
+ * @FilePath: \Cloud-API-Demo-Web\src\components\g-map\use-connect-mqtt.ts
+ * @Description:
+ *
+ * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
+ */
import {
ref,
diff --git a/src/mqtt/config.ts b/src/mqtt/config.ts
index 7f3e5bf..ee8516c 100644
--- a/src/mqtt/config.ts
+++ b/src/mqtt/config.ts
@@ -7,10 +7,10 @@
connectTimeout: 10000, // mqtt 超时时间
resubscribe: true, // 断开重连后,再次订阅原订阅
reconnectPeriod: 10000, // 重连间隔时间: 5s
- keepalive: 1, // 心跳间隔时间:1s
+ keepalive: 5, // 心跳间隔时间:1s
clientId: 'DroneWeb',
- username: 'root',
- password: 'root',
+ // username: 'root',
+ // password: 'root',
host: '182.106.212.58',
protocol: 'ws',
port: 35675,
diff --git a/src/mqtt/index.ts b/src/mqtt/index.ts
index 2028edc..6b5eee4 100644
--- a/src/mqtt/index.ts
+++ b/src/mqtt/index.ts
@@ -34,7 +34,6 @@
...OPTIONS,
...this._options,
})
- console.log(this._client, 'client')
this._hasInit = true
if (this._client) {
this._client.on('reconnect', this._onReconnect)
--
Gitblit v1.9.3