parent
a444504225
commit
6ddf2d8937
@ -107,43 +107,43 @@ export async function loadLineNetDatas(app: GraphicApp) {
|
||||
pathLineList.forEach((pathLine) => {
|
||||
pathLine.visible = false;
|
||||
});
|
||||
// app.enableWsMassaging({
|
||||
// wsUrl: `${getWebsocketUrl()}`,
|
||||
// token: getJwtToken() as string,
|
||||
// });
|
||||
// app.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;
|
||||
// },
|
||||
// });
|
||||
// app.subscribe({
|
||||
// destination: '/queue/xian/ncc/alert',
|
||||
// messageHandle: (message: Uint8Array) => {
|
||||
// const storage = alert.NccAlertInfoMessage.deserialize(message);
|
||||
// lineNetStore.setAlarmInfo(storage.messages as []);
|
||||
// },
|
||||
// });
|
||||
// let msgNotify: null | ((props?: QNotifyUpdateOptions | undefined) => void) =
|
||||
// null;
|
||||
// app.on('websocket-connect-state-change', (connected) => {
|
||||
// if (!connected && !msgNotify) {
|
||||
// msgNotify = Notify.create({
|
||||
// type: 'negative',
|
||||
// timeout: 0,
|
||||
// position: 'top-right',
|
||||
// message: '通信链接已断开!',
|
||||
// });
|
||||
// } else if (msgNotify && connected) {
|
||||
// msgNotify();
|
||||
// msgNotify = null;
|
||||
// }
|
||||
// });
|
||||
app.enableWsMassaging({
|
||||
wsUrl: `${getWebsocketUrl()}`,
|
||||
token: getJwtToken() as string,
|
||||
});
|
||||
app.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;
|
||||
},
|
||||
});
|
||||
app.subscribe({
|
||||
destination: '/queue/xian/ncc/alert',
|
||||
messageHandle: (message: Uint8Array) => {
|
||||
const storage = alert.NccAlertInfoMessage.deserialize(message);
|
||||
lineNetStore.setAlarmInfo(storage.messages as []);
|
||||
},
|
||||
});
|
||||
let msgNotify: null | ((props?: QNotifyUpdateOptions | undefined) => void) =
|
||||
null;
|
||||
app.on('websocket-connect-state-change', (connected) => {
|
||||
if (!connected && !msgNotify) {
|
||||
msgNotify = Notify.create({
|
||||
type: 'negative',
|
||||
timeout: 0,
|
||||
position: 'top-right',
|
||||
message: '通信链接已断开!',
|
||||
});
|
||||
} else if (msgNotify && connected) {
|
||||
msgNotify();
|
||||
msgNotify = null;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
app.loadGraphic([]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user