@mixd-id/web-scaffold 0.1.230406277 → 0.1.230406279

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mixd-id/web-scaffold",
3
3
  "private": false,
4
- "version": "0.1.230406277",
4
+ "version": "0.1.230406279",
5
5
  "scripts": {
6
6
  "dev": "vite serve",
7
7
  "build": "vite build",
package/src/utils/wss.js CHANGED
@@ -159,9 +159,7 @@ class WSS extends EventEmitter2{
159
159
  data = arr.length > 0 ? JSON.parse(JSON.stringify(arr.pop())) : data
160
160
  }
161
161
  catch(e){
162
- if(process.verbose){
163
- process.verbose('wss.error', e)
164
- }
162
+ '$report' in process ? process.$report(e) : console.error(e)
165
163
 
166
164
  status = 500
167
165
  data = {
@@ -197,20 +195,22 @@ class WSS extends EventEmitter2{
197
195
  return socket.close(1002, e.message);
198
196
  }
199
197
 
200
- const ping = async() => {
201
- socket.send(await this.toBinaryData({ ping:1 }))
202
- socket.pinging = true
203
-
204
- setTimeout(() => {
205
- if(socket.pinging){
206
- socket.close(1002, 'ping timeout')
207
- }
208
- else{
209
- setTimeout(ping, (Math.round(Math.random() * 10) % 5) * 5000)
210
- }
211
- }, 3000)
198
+ if(this._opt.ping !== false){
199
+ const ping = async() => {
200
+ socket.send(await this.toBinaryData({ ping:1 }))
201
+ socket.pinging = true
202
+
203
+ setTimeout(() => {
204
+ if(socket.pinging){
205
+ socket.close(1002, 'ping timeout')
206
+ }
207
+ else{
208
+ setTimeout(ping, (Math.round(Math.random() * 10) % 5) * 5000)
209
+ }
210
+ }, 3000)
211
+ }
212
+ setTimeout(ping, (Math.round(Math.random() * 10) % 5) * 5000)
212
213
  }
213
- setTimeout(ping, (Math.round(Math.random() * 10) % 5) * 5000)
214
214
  })
215
215
  }
216
216
 
package/src/utils/wss.mjs CHANGED
@@ -92,8 +92,6 @@ class WSS extends EventEmitter2{
92
92
 
93
93
  async connect(reconnect = false){
94
94
 
95
- console.log('connect', this._opt.token)
96
-
97
95
  this._instance = new WebSocket(this._opt.url, [ this._opt.token ])
98
96
 
99
97
  this._instance.binaryType = 'arraybuffer';