修改消息订阅顺序问题
This commit is contained in:
parent
a1a9eac588
commit
e521b07d86
@ -11,4 +11,6 @@ export function getHttpBase() {
|
|||||||
export function getWebsocketUrl() {
|
export function getWebsocketUrl() {
|
||||||
const host = '192.168.3.233:8000';
|
const host = '192.168.3.233:8000';
|
||||||
return `ws://${host}/connection/websocket`;
|
return `ws://${host}/connection/websocket`;
|
||||||
|
// const host = '192.168.3.233:9081';
|
||||||
|
// return `ws://${host}/ws-default`;
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,9 @@ export class WsMsgCli {
|
|||||||
const cli = WsMsgCli.client;
|
const cli = WsMsgCli.client;
|
||||||
cli.on('connected', () => {
|
cli.on('connected', () => {
|
||||||
WsMsgCli.emitConnectStateChangeEvent(true);
|
WsMsgCli.emitConnectStateChangeEvent(true);
|
||||||
|
WsMsgCli.appMsgBroker.forEach((broker) => {
|
||||||
|
broker.resubscribe();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
cli.on('disconnected', () => {
|
cli.on('disconnected', () => {
|
||||||
WsMsgCli.emitConnectStateChangeEvent(false);
|
WsMsgCli.emitConnectStateChangeEvent(false);
|
||||||
@ -123,11 +126,11 @@ export class WsMsgCli {
|
|||||||
static trySubscribe(
|
static trySubscribe(
|
||||||
destination: string,
|
destination: string,
|
||||||
handler: MessageHandler
|
handler: MessageHandler
|
||||||
): ISubscription {
|
): ISubscription | undefined {
|
||||||
return WsMsgCli.client.subscribe(destination, handler);
|
if (WsMsgCli.isConnected()) {
|
||||||
// if (WsMsgCli.isConnected()) {
|
return WsMsgCli.client.subscribe(destination, handler);
|
||||||
// }
|
}
|
||||||
// return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
static registerAppMsgBroker(broker: AppWsMsgBroker) {
|
static registerAppMsgBroker(broker: AppWsMsgBroker) {
|
||||||
|
@ -160,8 +160,6 @@ function toggleFullscreen(e: unknown): void {
|
|||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log('绘制应用layout mounted');
|
console.log('绘制应用layout mounted');
|
||||||
|
|
||||||
const basic = Base64.decode('Zm9vOmJhcg==');
|
|
||||||
console.log(basic);
|
|
||||||
const dom = document.getElementById('draw-app-container');
|
const dom = document.getElementById('draw-app-container');
|
||||||
if (dom) {
|
if (dom) {
|
||||||
const drawApp = drawStore.initDrawApp(dom);
|
const drawApp = drawStore.initDrawApp(dom);
|
||||||
@ -175,10 +173,11 @@ onMounted(() => {
|
|||||||
protocol: 'json',
|
protocol: 'json',
|
||||||
wsUrl: getWebsocketUrl(),
|
wsUrl: getWebsocketUrl(),
|
||||||
token:
|
token:
|
||||||
|
// 'Bearer eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJzZWxmIiwic3ViIjoiNiIsImV4cCI6MTY5MDc5MDczMSwiaWF0IjoxNjkwNTMxNTMxfQ.caXc0jfI766p57Qx6hnuMp6XPpnBvfQuBeFI5-mlOHLBEK6Js13jy0cfGX_FxICWUGEEV0lYI8U1EfCDYPyQ38i4BcHe88mq4jK6byztuyWtkWjx4nOMcCwO-haOfJ2E0pIJOOm5aFBWT2YRdlb63gjvDbyLwdsvO1wr4-QSkB2uyyKpTaFnYP4OiF264UdN-XYuME5k_RkjcinvcYjPR7WI2YCu_Sg0exzqQW03pspTyx5ozbuc_3JSkOA7g4aqnizMJgVAsCbTwYBnfvLClDbcztkyaqbhN5pA4Eme_yPos4ISfufjR7TyUROVp7yEV6gSLHRtPulageQxNhltXA',
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTA2MTM0MzUsImlkIjo2LCJvcmlnX2lhdCI6MTY5MDUyNzAzNSwic3ViIjoiNiJ9.sRCFji8-90hXK_l_O2ScQHYSpmnw8TILmrZGCyR9RCo',
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTA2MTM0MzUsImlkIjo2LCJvcmlnX2lhdCI6MTY5MDUyNzAzNSwic3ViIjoiNiJ9.sRCFji8-90hXK_l_O2ScQHYSpmnw8TILmrZGCyR9RCo',
|
||||||
});
|
});
|
||||||
drawApp.subscribe({
|
drawApp.subscribe({
|
||||||
destination: 'test2',
|
destination: '/queue/lineNet',
|
||||||
messageHandle: (msg) => {
|
messageHandle: (msg) => {
|
||||||
// const storage = graphicData.RtssGraphicStorage.deserialize(msg);
|
// const storage = graphicData.RtssGraphicStorage.deserialize(msg);
|
||||||
console.log('设备消息处理', msg);
|
console.log('设备消息处理', msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user