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