This commit is contained in:
joylink_zhaoerwei 2023-12-20 17:41:56 +08:00
parent 8d926b37cd
commit 5d83a368e0
3 changed files with 4 additions and 8 deletions

View File

@ -2,12 +2,8 @@ import { HandleMessage, StompMessagingClient } from 'jl-graphic';
import { getJwtToken } from 'src/configs/TokenManage'; import { getJwtToken } from 'src/configs/TokenManage';
import { getWebsocketUrl } from 'src/configs/UrlManage'; import { getWebsocketUrl } from 'src/configs/UrlManage';
export function webSocketConnect( export function webSocketConnect(destination: string, handler: HandleMessage) {
socket: StompMessagingClient | null, const socket = new StompMessagingClient({
destination: string,
handler: HandleMessage
) {
socket = new StompMessagingClient({
wsUrl: `${getWebsocketUrl()}`, wsUrl: `${getWebsocketUrl()}`,
token: getJwtToken() as string, token: getJwtToken() as string,
protocol: 'protobuf', protocol: 'protobuf',

View File

@ -165,7 +165,7 @@ onMounted(() => {
} }
document.addEventListener('click', watchInteract); document.addEventListener('click', watchInteract);
document.addEventListener('keydown', watchInteract); document.addEventListener('keydown', watchInteract);
socket = webSocketConnect(socket, destination, handler); socket = webSocketConnect(destination, handler);
}); });
// //

View File

@ -372,7 +372,7 @@ onMounted(() => {
setTimeout(() => { setTimeout(() => {
tableRef.value.requestServerInteraction(); tableRef.value.requestServerInteraction();
lineNetStore.alarmInfoListTable = tableRef.value; lineNetStore.alarmInfoListTable = tableRef.value;
socket = webSocketConnect(socket, destination, handler); socket = webSocketConnect(destination, handler);
}); });
}); });