订阅处理

This commit is contained in:
joylink_fanyuhong 2024-11-12 09:17:32 +08:00
parent cdcad825f7
commit 33292ca9b8
2 changed files with 9 additions and 6 deletions

View File

@ -267,12 +267,12 @@ export function cancelSubscribe(lineApp: IGraphicApp) {
if (lineId) {
lineApp.unsubscribe(`/queue/line/${lineId}/device`);
lineApp.unsubscribe(`/queue/line/${lineId}/train`);
const userStore = useUserStore();
getMonitorPath(userStore.roles).destinations.forEach((destination) => {
monitorDestinations.forEach((destination) => {
lineApp.unsubscribe(destination);
});
}
}
let monitorDestinations: string[] = [];
function handleSubscribe(lineApp: IGraphicApp) {
const lineStore = useLineStore();
const lineId = lineStore.lineId;
@ -327,7 +327,8 @@ function handleSubscribe(lineApp: IGraphicApp) {
});
const lineNetStore = useLineNetStore();
const userStore = useUserStore();
getMonitorPath(userStore.roles).destinations.forEach((destination) => {
monitorDestinations = getMonitorPath(userStore.roles).destinations;
monitorDestinations.forEach((destination) => {
lineApp.subscribe({
destination,
messageHandle: (message: Uint8Array) => {

View File

@ -151,11 +151,12 @@ export async function loadLineNetDatas(): Promise<IGraphicStorage> {
export function cancelSubscribe(lineNetApp: IGraphicApp) {
lineNetApp.unsubscribe('/queue/lineNet');
const userStore = useUserStore();
getMonitorPath(userStore.roles).destinations.forEach((destination) => {
monitorDestinations.forEach((destination) => {
lineNetApp.unsubscribe(destination);
});
}
let monitorDestinations: string[] = [];
export function handleSubscribe(lineNetApp: IGraphicApp) {
const lineNetStore = useLineNetStore();
lineNetApp.enableWsMassaging({
@ -175,7 +176,8 @@ export function handleSubscribe(lineNetApp: IGraphicApp) {
},
});
const userStore = useUserStore();
getMonitorPath(userStore.roles).destinations.forEach((destination) => {
monitorDestinations = getMonitorPath(userStore.roles).destinations;
monitorDestinations.forEach((destination) => {
lineNetApp.subscribe({
destination,
messageHandle: (message: Uint8Array) => {