From 5e440a7dc434c43eb828fa62cf9c12b0078b8565 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期一, 20 一月 2025 11:36:18 +0800 Subject: [PATCH] !173 发布 5.3.0-BETA 公测版本 Merge pull request !173 from 疯狂的狮子Li/dev --- src/utils/websocket.ts | 28 ++++------------------------ 1 files changed, 4 insertions(+), 24 deletions(-) diff --git a/src/utils/websocket.ts b/src/utils/websocket.ts index 37942d8..c9b394c 100644 --- a/src/utils/websocket.ts +++ b/src/utils/websocket.ts @@ -1,23 +1,3 @@ -/** - * @module initWebSocket 鍒濆鍖� - * @module websocketonopen 杩炴帴鎴愬姛 - * @module websocketonerror 杩炴帴澶辫触 - * @module websocketclose 鏂紑杩炴帴 - * @module resetHeart 閲嶇疆蹇冭烦 - * @module sendSocketHeart 蹇冭烦鍙戦�� - * @module reconnect 閲嶈繛 - * @module sendMsg 鍙戦�佹暟鎹� - * @module websocketonmessage 鎺ユ敹鏁版嵁 - * @module test 娴嬭瘯鏀跺埌娑堟伅浼犻�� - * @description socket 閫氫俊 - * @param {any} url socket鍦板潃 - * @param {any} websocket websocket 瀹炰緥 - * @param {any} heartTime 蹇冭烦瀹氭椂鍣ㄥ疄渚� - * @param {number} socketHeart 蹇冭烦娆℃暟 - * @param {number} HeartTimeOut 蹇冭烦瓒呮椂鏃堕棿 - * @param {number} socketError 閿欒娆℃暟 - */ - import { getToken } from '@/utils/auth'; import { ElNotification } from 'element-plus'; import useNoticeStore from '@/store/modules/notice'; @@ -27,7 +7,7 @@ if (import.meta.env.VITE_APP_WEBSOCKET === 'false') { return; } - url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID + url = url + '?Authorization=Bearer ' + getToken() + '&clientid=' + import.meta.env.VITE_APP_CLIENT_ID; useWebSocket(url, { autoReconnect: { // 閲嶈繛鏈�澶ф鏁� @@ -36,14 +16,14 @@ delay: 1000, onFailed() { console.log('websocket閲嶈繛澶辫触'); - }, + } }, heartbeat: { - message: JSON.stringify({type: 'ping'}), + message: JSON.stringify({ type: 'ping' }), // 鍙戦�佸績璺崇殑闂撮殧 interval: 10000, // 鎺ユ敹鍒板績璺硆esponse鐨勮秴鏃舵椂闂� - pongTimeout: 2000, + pongTimeout: 2000 }, onConnected() { console.log('websocket宸茬粡杩炴帴'); -- Gitblit v1.9.3