From 11433d0f47eae3403e883fc26d72269b930235f2 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 11 Sep 2023 16:51:20 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/develop' into develop
---
src/websocket/index.ts | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/websocket/index.ts b/src/websocket/index.ts
index 8edd25c..cb602c4 100644
--- a/src/websocket/index.ts
+++ b/src/websocket/index.ts
@@ -1,5 +1,7 @@
+
import { message } from 'ant-design-vue'
import ReconnectingWebSocket from 'reconnecting-websocket'
+import { ELocalStorageKey } from '../types'
interface WebSocketOptions {
data: any
@@ -35,14 +37,14 @@
if (!this._url) {
return
}
-
+ const token: string = localStorage.getItem(ELocalStorageKey.Token) || '' as string
// 会自动重连,无需处理重连逻辑
+ console.log(token, 'token')
this._socket = new ReconnectingWebSocket(this._url, [], {
maxReconnectionDelay: 20000, // 断开后最大的重连时间: 20s,每多一次重连,会增加 1.3 倍,5 * 1.3 * 1.3 * 1.3...
minReconnectionDelay: 5000, // 断开后最短的重连时间: 5s
- maxRetries: 5
+ maxRetries: 5,
})
-
this._hasInit = true
this._socket.addEventListener('open', this._onOpen.bind(this))
--
Gitblit v1.9.3