diff --git a/src/components/webSocketConnect.ts b/src/components/webSocketConnect.ts index d0042a7..31157f9 100644 --- a/src/components/webSocketConnect.ts +++ b/src/components/webSocketConnect.ts @@ -2,12 +2,8 @@ import { HandleMessage, StompMessagingClient } from 'jl-graphic'; import { getJwtToken } from 'src/configs/TokenManage'; import { getWebsocketUrl } from 'src/configs/UrlManage'; -export function webSocketConnect( - socket: StompMessagingClient | null, - destination: string, - handler: HandleMessage -) { - socket = new StompMessagingClient({ +export function webSocketConnect(destination: string, handler: HandleMessage) { + const socket = new StompMessagingClient({ wsUrl: `${getWebsocketUrl()}`, token: getJwtToken() as string, protocol: 'protobuf', diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 18f9327..f35de31 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -165,7 +165,7 @@ onMounted(() => { } document.addEventListener('click', watchInteract); document.addEventListener('keydown', watchInteract); - socket = webSocketConnect(socket, destination, handler); + socket = webSocketConnect(destination, handler); }); //模拟报警 diff --git a/src/pages/AlarmInfoList.vue b/src/pages/AlarmInfoList.vue index 0037e41..c134790 100644 --- a/src/pages/AlarmInfoList.vue +++ b/src/pages/AlarmInfoList.vue @@ -372,7 +372,7 @@ onMounted(() => { setTimeout(() => { tableRef.value.requestServerInteraction(); lineNetStore.alarmInfoListTable = tableRef.value; - socket = webSocketConnect(socket, destination, handler); + socket = webSocketConnect(destination, handler); }); });