vim-web 0.3.42-dev.2 → 0.3.42-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vim-web.js
CHANGED
|
@@ -59719,7 +59719,6 @@ class SocketClient {
|
|
|
59719
59719
|
__publicField(this, "_rpcCallId", 0);
|
|
59720
59720
|
__publicField(this, "_reconnectTimeout");
|
|
59721
59721
|
__publicField(this, "_connectionTimeout");
|
|
59722
|
-
__publicField(this, "_retries", -1);
|
|
59723
59722
|
__publicField(this, "_validateConnection");
|
|
59724
59723
|
/**
|
|
59725
59724
|
* Callback function to handle incoming video frames.
|
|
@@ -59730,7 +59729,7 @@ class SocketClient {
|
|
|
59730
59729
|
__publicField(this, "_state", { status: "disconnected" });
|
|
59731
59730
|
__publicField(this, "_onStatusUpdate", new distExports.SimpleEventDispatcher());
|
|
59732
59731
|
__publicField(this, "_connectPromise", new ResolvedPromise(void 0));
|
|
59733
|
-
__publicField(this, "
|
|
59732
|
+
__publicField(this, "_connectionSettings");
|
|
59734
59733
|
this._logger = logger;
|
|
59735
59734
|
this._rpcCallId = 0;
|
|
59736
59735
|
this._streamLogger = new StreamLogger(logger);
|
|
@@ -59763,7 +59762,8 @@ class SocketClient {
|
|
|
59763
59762
|
* @returns The WebSocket URL as a string, or undefined if not set.
|
|
59764
59763
|
*/
|
|
59765
59764
|
get url() {
|
|
59766
|
-
|
|
59765
|
+
var _a2;
|
|
59766
|
+
return (_a2 = this._connectionSettings) == null ? void 0 : _a2.url;
|
|
59767
59767
|
}
|
|
59768
59768
|
/**
|
|
59769
59769
|
* Connects to a WebSocket server at the specified URL.
|
|
@@ -59773,7 +59773,9 @@ class SocketClient {
|
|
|
59773
59773
|
connect(settings2) {
|
|
59774
59774
|
settings2 = {
|
|
59775
59775
|
url: (settings2 == null ? void 0 : settings2.url) ?? DEFAULT_LOCAL_ULTRA_SERVER_URL,
|
|
59776
|
-
retries: (settings2 == null ? void 0 : settings2.retries) ?? 0
|
|
59776
|
+
retries: (settings2 == null ? void 0 : settings2.retries) ?? 0,
|
|
59777
|
+
timeout: (settings2 == null ? void 0 : settings2.timeout) ?? 5e3,
|
|
59778
|
+
retryDelay: (settings2 == null ? void 0 : settings2.retryDelay) ?? 5e3
|
|
59777
59779
|
};
|
|
59778
59780
|
const url = settings2.url;
|
|
59779
59781
|
if (!isWebSocketUrl(url)) {
|
|
@@ -59789,12 +59791,11 @@ class SocketClient {
|
|
|
59789
59791
|
}
|
|
59790
59792
|
}
|
|
59791
59793
|
this._connectPromise = new ControllablePromise();
|
|
59792
|
-
this.
|
|
59793
|
-
this._retries = settings2.retries;
|
|
59794
|
+
this._connectionSettings = settings2;
|
|
59794
59795
|
this.updateState({ status: "connecting" });
|
|
59795
59796
|
try {
|
|
59796
59797
|
this._socket = new WebSocket(url);
|
|
59797
|
-
this._connectionTimeout = setTimeout(() => this._onClose(),
|
|
59798
|
+
this._connectionTimeout = setTimeout(() => this._onClose(), settings2.timeout);
|
|
59798
59799
|
this._socket.onopen = (e) => {
|
|
59799
59800
|
this._onOpen(e);
|
|
59800
59801
|
};
|
|
@@ -59817,8 +59818,8 @@ class SocketClient {
|
|
|
59817
59818
|
* Disconnects from the current WebSocket server.
|
|
59818
59819
|
*/
|
|
59819
59820
|
disconnect(error) {
|
|
59820
|
-
this._logger.log("Disconnecting from: ", this.
|
|
59821
|
-
this.
|
|
59821
|
+
this._logger.log("Disconnecting from: ", this.url);
|
|
59822
|
+
this._connectionSettings = void 0;
|
|
59822
59823
|
this._disconnect(error);
|
|
59823
59824
|
}
|
|
59824
59825
|
/**
|
|
@@ -59913,19 +59914,20 @@ class SocketClient {
|
|
|
59913
59914
|
* @param _event - The event object.
|
|
59914
59915
|
*/
|
|
59915
59916
|
_onClose(_event) {
|
|
59916
|
-
clearTimeout(this._connectionTimeout);
|
|
59917
|
-
this._disconnect({ status: "error", error: "connection", serverUrl: this._connectingUrl });
|
|
59918
59917
|
this._logger.log("WebSocket closed.");
|
|
59919
|
-
|
|
59920
|
-
|
|
59921
|
-
|
|
59922
|
-
|
|
59923
|
-
|
|
59924
|
-
|
|
59925
|
-
retries: this._retries - 1
|
|
59926
|
-
});
|
|
59927
|
-
}, 5e3);
|
|
59918
|
+
clearTimeout(this._connectionTimeout);
|
|
59919
|
+
this._disconnect({ status: "error", error: "connection", serverUrl: this.url });
|
|
59920
|
+
if (this._connectionSettings.retries === 0) {
|
|
59921
|
+
this._logger.log("No more retries left");
|
|
59922
|
+
this._connectPromise.resolve();
|
|
59923
|
+
return;
|
|
59928
59924
|
}
|
|
59925
|
+
this._logger.log("Attempting to reconnect in 5 seconds");
|
|
59926
|
+
this._reconnectTimeout = setTimeout(() => {
|
|
59927
|
+
this.updateState({ status: "connecting" });
|
|
59928
|
+
this._connectionSettings.retries--;
|
|
59929
|
+
this.connect(this._connectionSettings);
|
|
59930
|
+
}, this._connectionSettings.retryDelay);
|
|
59929
59931
|
}
|
|
59930
59932
|
/**
|
|
59931
59933
|
* Sends binary data over the WebSocket connection.
|