husq
2023-09-19 d185d363561ab3622ff09f83bc5f14d38498f385
mqtt连接
4 files modified
35 ■■■■ changed files
src/api/http/config.ts 18 ●●●● patch | view | raw | blame | history
src/components/g-map/use-connect-mqtt.ts 10 ●●●●● patch | view | raw | blame | history
src/mqtt/config.ts 6 ●●●● patch | view | raw | blame | history
src/mqtt/index.ts 1 ●●●● patch | view | raw | blame | history
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.
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,
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,
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)