fix: 断开连接

This commit is contained in:
song_xiao_lin
2024-05-08 17:06:57 +08:00
parent 4daf96f637
commit eaecc8eacd
+2 -1
View File
@@ -27,7 +27,7 @@ export class WebSocketManager {
};
this.socket.onclose = () => {
chrome.runtime.sendMessage({action: ActionType.STATUS, connected: false, port: port});
chrome.runtime.sendMessage({action: ActionType.STATUS, connected: false});
};
this.socket.onerror = (error) => {
@@ -39,6 +39,7 @@ export class WebSocketManager {
if (this.socket) {
try {
this.socket.close();
chrome.runtime.sendMessage({action: ActionType.STATUS, connected: false});
} catch (e) {
console.error("Error closing websocket:", e);
}