refactor(web-antd): 用 SSE 替代 WebSocket 实现通知和电表数据实时推送

This commit is contained in:
2025-09-06 13:15:36 +08:00
parent 6f987f29ef
commit 621674ed1f
3 changed files with 79 additions and 88 deletions

View File

@@ -16,8 +16,6 @@ import { $t } from '#/locales'
import { useDictStore } from './dict'
import { initWebSocket, getWebSocketService } from '#/api/websocket'
export const useAuthStore = defineStore('auth', () => {
const accessStore = useAccessStore()
const userStore = useUserStore()
@@ -81,13 +79,6 @@ export const useAuthStore = defineStore('auth', () => {
try {
await seeConnectionClose()
await doLogout()
/**
* 断开websocket连接
*/
const ws = getWebSocketService();
if(ws) {
ws.close();
}
} catch (error) {
console.error(error)
} finally {
@@ -128,11 +119,6 @@ export const useAuthStore = defineStore('auth', () => {
}
userStore.setUserInfo(userInfo)
/**
* 初始化websocket
*/
initWebSocket()
/**
* 需要重新加载字典
* 比如退出登录切换到其他租户