mirror of
https://gitee.com/eolink_admin/postcat.git
synced 2024-11-30 02:37:57 +08:00
feat: unListen while Server disconnect
This commit is contained in:
parent
bdbe0958ad
commit
118da2244b
@ -221,13 +221,20 @@ export class WebsocketComponent implements OnInit, OnDestroy {
|
||||
this.switchEditStatus();
|
||||
}
|
||||
}
|
||||
if (type === 'ws-message-back' && status === 0) {
|
||||
const { type: msgType } = this.model.response.responseBody.at();
|
||||
if (msgType === 'end') {
|
||||
// * If the last message is disconnect type, then do not push new message to list
|
||||
return;
|
||||
if (type === 'ws-message-back') {
|
||||
if (status === 0) {
|
||||
const { type: msgType } = this.model.response.responseBody.at();
|
||||
if (msgType === 'end') {
|
||||
// * If the last message is disconnect type, then do not push new message to list
|
||||
return;
|
||||
}
|
||||
this.model.response.responseBody.unshift({ type: 'get', msg: content, isExpand: false });
|
||||
} else {
|
||||
this.model.response.responseBody.unshift({ type: 'end', msg: 'Disconnect by Server', isExpand: false });
|
||||
this.wsStatus = 'disconnect';
|
||||
this.switchEditStatus();
|
||||
this.unListen();
|
||||
}
|
||||
this.model.response.responseBody.unshift({ type: 'get', msg: content, isExpand: false });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user