mirror of
https://github.com/yaklang/yaklang-chrome-extension.git
synced 2026-09-26 21:21:53 +08:00
fix: 修复重连问题
This commit is contained in:
+3
-3
@@ -13,12 +13,12 @@ export class WebSocketManager {
|
||||
this.intervalId = null;
|
||||
}
|
||||
|
||||
connectWebsocket(url) {
|
||||
connectWebsocket(url, port) {
|
||||
this.disconnectWebsocket();
|
||||
this.socket = new WebSocket(url);
|
||||
|
||||
this.socket.onopen = () => {
|
||||
chrome.runtime.sendMessage({action: ActionType.STATUS, connected: true});
|
||||
chrome.runtime.sendMessage({action: ActionType.STATUS, connected: true, port: port});
|
||||
this.startHeartbeat();
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ export class WebSocketManager {
|
||||
};
|
||||
|
||||
this.socket.onclose = () => {
|
||||
chrome.runtime.sendMessage({action: ActionType.STATUS, connected: false});
|
||||
chrome.runtime.sendMessage({action: ActionType.STATUS, connected: false, port: port});
|
||||
};
|
||||
|
||||
this.socket.onerror = (error) => {
|
||||
|
||||
Reference in New Issue
Block a user