2 files modified
7 ■■■■ changed files
src/api/http/config.ts 2 ●●● patch | view | raw | blame | history
src/websocket/index.ts 5 ●●●●● patch | view | raw | blame | history
src/api/http/config.ts
@@ -8,7 +8,7 @@
  // http://172.16.13.64:8100
  // baseURL: 'http://192.168.1.133:6789', // This url must end with "/". Example: 'http://192.168.1.1:6789/'
  // baseURL: 'http://192.168.1.133:6789', // 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://wrj.shuixiongit.com/api/', // This url must end with "/". Example: 'http://192.168.1.1:6789/'
  // ws: 'ws//127.0.0.1:6789/api/v1/ws',
  ws: 'wss://wrj.shuixiongit.com/drone-wss/api/v1/ws',
  // ws://192.168.1.198:1883/
src/websocket/index.ts
@@ -36,6 +36,11 @@
    if (!this._url) {
      return
    }
    console.log('测试URL' + this._url)
    const dates = this._url
    let newUrl = ''
    newUrl = dates.replace('bearer ', '')
    console.log('gengxin--++-++-++--' + newUrl)
    // 会自动重连,无需处理重连逻辑
    this._socket = new ReconnectingWebSocket(this._url, [], {
      maxReconnectionDelay: 20000, // 断开后最大的重连时间: 20s,每多一次重连,会增加 1.3 倍,5 * 1.3 * 1.3 * 1.3...