订阅调整
This commit is contained in:
parent
b90522ec42
commit
6f4d1f8c05
@ -1 +1 @@
|
||||
Subproject commit 023c84c4ccf7f38e477253e1b49856bfb50aca18
|
||||
Subproject commit 3fe8f895fa2458f7e7b93f24558fdc81a11c3f13
|
@ -112,36 +112,13 @@ export function initLineNetApp(): IGraphicApp {
|
||||
pathLineList.forEach((pathLine) => {
|
||||
pathLine.visible = false;
|
||||
});
|
||||
handleSubscribe(lineNetApp);
|
||||
});
|
||||
|
||||
lineNetApp.registerGraphicTemplates(...graphicTemplate);
|
||||
|
||||
RunLineOperateInteraction.init(lineNetApp);
|
||||
|
||||
lineNetApp.enableWsMassaging({
|
||||
wsUrl: `${getWebsocketUrl()}`,
|
||||
token: getJwtToken() as string,
|
||||
});
|
||||
lineNetApp.subscribe({
|
||||
destination: '/queue/lineNet',
|
||||
|
||||
messageConverter: (message: Uint8Array) => {
|
||||
const storage = state.WsLineNetMessage.deserialize(message);
|
||||
const states: GraphicState[] = [];
|
||||
storage.offset.forEach((item) => {
|
||||
states.push(new TrainLineState(item));
|
||||
});
|
||||
return states;
|
||||
},
|
||||
});
|
||||
lineNetApp.subscribe({
|
||||
destination: '/queue/xian/ncc/alert',
|
||||
messageHandle: (message: Uint8Array) => {
|
||||
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
||||
lineNetStore.setAlarmInfo(storage.messages as []);
|
||||
},
|
||||
});
|
||||
|
||||
let msgNotify: ReturnType<Notify['create']> | null = null;
|
||||
lineNetApp.on('websocket-connect-state-change', (connected) => {
|
||||
if (!connected && !msgNotify) {
|
||||
@ -158,3 +135,30 @@ export function initLineNetApp(): IGraphicApp {
|
||||
});
|
||||
return lineNetApp;
|
||||
}
|
||||
|
||||
function handleSubscribe(lineNetApp: IGraphicApp) {
|
||||
const lineNetStore = useLineNetStore();
|
||||
lineNetApp.enableWsMassaging({
|
||||
wsUrl: `${getWebsocketUrl()}`,
|
||||
token: getJwtToken() as string,
|
||||
});
|
||||
lineNetApp.subscribe({
|
||||
destination: '/queue/lineNet',
|
||||
createOnNotFound: { graphicTypes: [TrainLine.Type] },
|
||||
messageConverter: (message: Uint8Array) => {
|
||||
const storage = state.WsLineNetMessage.deserialize(message);
|
||||
const states: GraphicState[] = [];
|
||||
storage.offset.forEach((item) => {
|
||||
states.push(new TrainLineState(item));
|
||||
});
|
||||
return states;
|
||||
},
|
||||
});
|
||||
lineNetApp.subscribe({
|
||||
destination: '/queue/xian/ncc/alert',
|
||||
messageHandle: (message: Uint8Array) => {
|
||||
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
||||
lineNetStore.setAlarmInfo(storage.messages as []);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user