feat: 代客下单socket消息发送增加是否发送初始化参数
This commit is contained in:
@@ -59,7 +59,7 @@ class WebSocketManager {
|
|||||||
this.sendMessage(this.initParams);
|
this.sendMessage(this.initParams);
|
||||||
this.clearTimer();
|
this.clearTimer();
|
||||||
this.timer = setInterval(() => {
|
this.timer = setInterval(() => {
|
||||||
this.sendMessage({ type: "ping_interval", set: 'manage' });
|
this.sendMessage({ type: "ping_interval", set: 'manage' }, false);
|
||||||
}, 1000 * 10);
|
}, 1000 * 10);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ class WebSocketManager {
|
|||||||
this.autoConnect = true
|
this.autoConnect = true
|
||||||
}
|
}
|
||||||
|
|
||||||
public sendMessage(message: any) {
|
public sendMessage(message: any, isSendInitParams: boolean = true) {
|
||||||
if (!this.client || !this.connected) {
|
if (!this.client || !this.connected) {
|
||||||
// ElMessage.error('发送失败,已重新连接,请重新操作');
|
// ElMessage.error('发送失败,已重新连接,请重新操作');
|
||||||
this.reconnect();
|
this.reconnect();
|
||||||
@@ -118,7 +118,7 @@ class WebSocketManager {
|
|||||||
this.disconnect();
|
this.disconnect();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const msg = JSON.stringify({ ...this.initParams, ...message });
|
const msg = JSON.stringify(isSendInitParams ? { ...this.initParams, ...message } : message);
|
||||||
try {
|
try {
|
||||||
this.client?.send(msg);
|
this.client?.send(msg);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user