angelia.io 2.4.74 → 2.4.77
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/client/index.js +10 -18
- package/package.json +1 -50
- package/server/Server.js +2 -2
package/client/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
class ClientWebWorker {
|
|
4
4
|
constructor() {
|
|
5
|
-
Blob.prototype.toJSON = function(){
|
|
5
|
+
Blob.prototype.toJSON = function () {
|
|
6
6
|
return {
|
|
7
|
-
b: new FileReaderSync().readAsDataURL(this)
|
|
7
|
+
b: new FileReaderSync().readAsDataURL(this),
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
|
-
ArrayBuffer.prototype.toJSON = function(){
|
|
10
|
+
ArrayBuffer.prototype.toJSON = function () {
|
|
11
11
|
return {
|
|
12
|
-
a: new FileReaderSync().readAsDataURL(this)
|
|
12
|
+
a: new FileReaderSync().readAsDataURL(this),
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
|
@@ -50,10 +50,7 @@ const ClientWebWorker = `class ClientWebWorker {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
connect(options) {
|
|
53
|
-
if (
|
|
54
|
-
this.reconnect &&
|
|
55
|
-
(!this.io || this.io.readyState === WebSocket.CLOSED)
|
|
56
|
-
) {
|
|
53
|
+
if (this.reconnect && (!this.io || this.io.readyState === WebSocket.CLOSED)) {
|
|
57
54
|
let url = new URL(options.url)
|
|
58
55
|
|
|
59
56
|
// parms creation
|
|
@@ -68,12 +65,7 @@ const ClientWebWorker = `class ClientWebWorker {
|
|
|
68
65
|
}
|
|
69
66
|
url.search = Object.entries(params)
|
|
70
67
|
.filter(([k, v]) => {
|
|
71
|
-
return !(
|
|
72
|
-
k === undefined ||
|
|
73
|
-
k === null ||
|
|
74
|
-
v === undefined ||
|
|
75
|
-
v === null
|
|
76
|
-
)
|
|
68
|
+
return !(k === undefined || k === null || v === undefined || v === null)
|
|
77
69
|
})
|
|
78
70
|
.map(([k, v]) => encodeURIComponent(k) + '=' + encodeURIComponent(v))
|
|
79
71
|
.join('&')
|
|
@@ -222,7 +214,7 @@ const ClientWebWorker = `class ClientWebWorker {
|
|
|
222
214
|
}
|
|
223
215
|
return id
|
|
224
216
|
}
|
|
225
|
-
}
|
|
217
|
+
}
|
|
226
218
|
|
|
227
219
|
class Client {
|
|
228
220
|
constructor(options) {
|
|
@@ -240,7 +232,7 @@ class Client {
|
|
|
240
232
|
}
|
|
241
233
|
|
|
242
234
|
const io = new Worker(
|
|
243
|
-
URL.createObjectURL(new Blob(["'use strict';new (" + ClientWebWorker + ')']), {
|
|
235
|
+
URL.createObjectURL(new Blob(["'use strict';new (" + ClientWebWorker.toString() + ')']), {
|
|
244
236
|
type: 'application/javascript; charset=utf-8',
|
|
245
237
|
}),
|
|
246
238
|
)
|
|
@@ -275,7 +267,7 @@ class Client {
|
|
|
275
267
|
window.addEventListener('unload', () => this.disconnect(true), true)
|
|
276
268
|
|
|
277
269
|
// to send messages fast without waiting for the connection
|
|
278
|
-
shouldConnect &&
|
|
270
|
+
shouldConnect && this.connect()
|
|
279
271
|
}
|
|
280
272
|
|
|
281
273
|
// public API
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "angelia.io",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.77",
|
|
4
4
|
"description": "WebSockets Server and Client API for node.js and the browser, with rooms support.",
|
|
5
5
|
"homepage": "https://github.com/titoBouzout/angelia.io",
|
|
6
6
|
"repository": {
|
|
@@ -46,54 +46,5 @@
|
|
|
46
46
|
"arrowParens": "avoid",
|
|
47
47
|
"quoteProps": "preserve",
|
|
48
48
|
"proseWrap": "preserve"
|
|
49
|
-
},
|
|
50
|
-
"eslintConfig": {
|
|
51
|
-
"env": {
|
|
52
|
-
"browser": true,
|
|
53
|
-
"node": true,
|
|
54
|
-
"es6": true
|
|
55
|
-
},
|
|
56
|
-
"parser": "babel-eslint",
|
|
57
|
-
"extends": "eslint:recommended",
|
|
58
|
-
"parserOptions": {
|
|
59
|
-
"ecmaFeatures": {
|
|
60
|
-
"experimentalObjectRestSpread": true,
|
|
61
|
-
"jsx": true,
|
|
62
|
-
"impliedStrict": true,
|
|
63
|
-
"es6": true
|
|
64
|
-
},
|
|
65
|
-
"es6": true,
|
|
66
|
-
"ecmaVersion": 6,
|
|
67
|
-
"sourceType": "module",
|
|
68
|
-
"allowImportExportEverywhere": false,
|
|
69
|
-
"codeFrame": false
|
|
70
|
-
},
|
|
71
|
-
"plugins": [
|
|
72
|
-
"react"
|
|
73
|
-
],
|
|
74
|
-
"rules": {
|
|
75
|
-
"comma-dangle": "off",
|
|
76
|
-
"indent": "off",
|
|
77
|
-
"linebreak-style": [
|
|
78
|
-
"error",
|
|
79
|
-
"unix"
|
|
80
|
-
],
|
|
81
|
-
"no-cond-assign": "off",
|
|
82
|
-
"no-console": "off",
|
|
83
|
-
"no-empty": "off",
|
|
84
|
-
"no-extra-boolean-cast": "off",
|
|
85
|
-
"no-extra-semi": "off",
|
|
86
|
-
"no-fallthrough": "off",
|
|
87
|
-
"no-func-assign": "off",
|
|
88
|
-
"no-inner-declarations": "off",
|
|
89
|
-
"no-mixed-spaces-and-tabs": "off",
|
|
90
|
-
"no-redeclare": "off",
|
|
91
|
-
"no-tabs": "off",
|
|
92
|
-
"no-undef": "off",
|
|
93
|
-
"no-global-assign": "off",
|
|
94
|
-
"no-unreachable": "off",
|
|
95
|
-
"no-unused-vars": "off",
|
|
96
|
-
"strict": "off"
|
|
97
|
-
}
|
|
98
49
|
}
|
|
99
50
|
}
|
package/server/Server.js
CHANGED
|
@@ -147,9 +147,9 @@ class ServerSingleton {
|
|
|
147
147
|
if (!io.closing) {
|
|
148
148
|
io.closing = true
|
|
149
149
|
if (options.debug) {
|
|
150
|
-
console.log('Server Shutting Down\n', this)
|
|
150
|
+
console.log('Socket Server Shutting Down\n', this)
|
|
151
151
|
} else {
|
|
152
|
-
console.log('Server Shutting Down\n')
|
|
152
|
+
console.log('Socket Server Shutting Down\n')
|
|
153
153
|
}
|
|
154
154
|
io.close()
|
|
155
155
|
if (options.debug) {
|