@mixd-id/web-scaffold 0.1.230406263 → 0.1.230406264
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/utils/wss.js +1 -0
- package/src/utils/wss.mjs +15 -4
package/package.json
CHANGED
package/src/utils/wss.js
CHANGED
package/src/utils/wss.mjs
CHANGED
|
@@ -119,8 +119,11 @@ class WSS extends EventEmitter2{
|
|
|
119
119
|
const { _requestId, status, data, auth } = obj
|
|
120
120
|
|
|
121
121
|
if(auth){
|
|
122
|
+
this._instance.isAuth = auth
|
|
123
|
+
|
|
122
124
|
reconnect ? this.emit('reconnect', null, []) : this.emit('connect', null, [])
|
|
123
125
|
|
|
126
|
+
console.log('pending send', this._pendingSend)
|
|
124
127
|
for(let sendParams of this._pendingSend){
|
|
125
128
|
this.sendSync(sendParams.path, sendParams.params, sendParams.cb, sendParams.err)
|
|
126
129
|
}
|
|
@@ -181,13 +184,15 @@ class WSS extends EventEmitter2{
|
|
|
181
184
|
}
|
|
182
185
|
|
|
183
186
|
sendSync(path, params, cb, err, override){
|
|
187
|
+
console.log('sendSync', path, this._instance.readyState)
|
|
184
188
|
|
|
185
|
-
if(this._instance.readyState
|
|
186
|
-
|
|
189
|
+
if(this._instance.readyState > 1){
|
|
190
|
+
console.log('unable to send, ready state not 1', this._instance.readyState)
|
|
187
191
|
return
|
|
188
192
|
}
|
|
189
|
-
else if(this._instance.
|
|
190
|
-
console.log('
|
|
193
|
+
else if(!this._instance.isAuth){
|
|
194
|
+
console.log('add pending send', { path, params, cb, err })
|
|
195
|
+
this._pendingSend.push({ path, params, cb, err })
|
|
191
196
|
return
|
|
192
197
|
}
|
|
193
198
|
|
|
@@ -234,6 +239,12 @@ class WSS extends EventEmitter2{
|
|
|
234
239
|
})
|
|
235
240
|
}
|
|
236
241
|
|
|
242
|
+
async resume(){
|
|
243
|
+
if(this._instance.readyState > 1){
|
|
244
|
+
return this.reconnect()
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
237
248
|
}
|
|
238
249
|
|
|
239
250
|
export {
|