mosquito-transport-js 0.2.5 → 0.2.6
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/package.json +1 -1
- package/src/helpers/peripherals.js +6 -3
- package/src/index.js +1 -1
package/package.json
CHANGED
|
@@ -98,9 +98,12 @@ export const cloneInstance = (v) => {
|
|
|
98
98
|
return v;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
export const listenReachableServer = (callback, projectUrl) =>
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
export const listenReachableServer = (callback, projectUrl) => {
|
|
102
|
+
let lastValue;
|
|
103
|
+
return ServerReachableListener.listenTo(projectUrl, t => {
|
|
104
|
+
if (typeof t === 'boolean' && t !== lastValue) callback?.(t);
|
|
105
|
+
}, true);
|
|
106
|
+
}
|
|
104
107
|
|
|
105
108
|
export const prefixStoragePath = (path, prefix = 'file:///') => {
|
|
106
109
|
if (!path) return path;
|
package/src/index.js
CHANGED
|
@@ -59,7 +59,7 @@ export class MosquitoTransport {
|
|
|
59
59
|
lastUid = thisUid;
|
|
60
60
|
|
|
61
61
|
if (lastSocketProcess) disconnectionGlich[lastSocketProcess] = true;
|
|
62
|
-
socket.close();
|
|
62
|
+
if (socket) socket.close();
|
|
63
63
|
|
|
64
64
|
const thisProcess = ++lastSocketProcess;
|
|
65
65
|
socket = io(`${this.config.wsPrefix}://${projectUrl.split('://')[1]}`, {
|