@cocreate/socket-server 1.24.1 → 1.24.3
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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/index.js +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.24.3](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.24.2...v1.24.3) (2023-12-18)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* if no sockets[i] continue ([fcab2cc](https://github.com/CoCreate-app/CoCreate-socket-server/commit/fcab2ccbf5ea6199ac2e2ceb111aa1fa6f23cf28))
|
|
7
|
+
|
|
8
|
+
## [1.24.2](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.24.1...v1.24.2) (2023-12-09)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* emit first part of method which is module name ([d5d2f2d](https://github.com/CoCreate-app/CoCreate-socket-server/commit/d5d2f2d70f1effece7e77c95cb409b82609ee228))
|
|
14
|
+
|
|
1
15
|
## [1.24.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.24.0...v1.24.1) (2023-12-05)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -403,8 +403,11 @@ class SocketServer extends EventEmitter {
|
|
|
403
403
|
if (authorized.authorized)
|
|
404
404
|
data = authorized.authorized
|
|
405
405
|
|
|
406
|
-
|
|
407
|
-
|
|
406
|
+
let mod = data.method.split('.')[0]
|
|
407
|
+
if (['storage', 'database', 'array', 'index', 'object'].includes(mod))
|
|
408
|
+
this.emit(data.method, data);
|
|
409
|
+
else
|
|
410
|
+
this.emit(mod, data);
|
|
408
411
|
}
|
|
409
412
|
}
|
|
410
413
|
} catch (e) {
|
|
@@ -414,6 +417,7 @@ class SocketServer extends EventEmitter {
|
|
|
414
417
|
|
|
415
418
|
async send(data) {
|
|
416
419
|
// const socket = this.sockets.get(data.socketId)
|
|
420
|
+
delete data.wsManager
|
|
417
421
|
const socket = data.socket
|
|
418
422
|
|
|
419
423
|
if (data.sync) {
|
|
@@ -457,6 +461,9 @@ class SocketServer extends EventEmitter {
|
|
|
457
461
|
delete data.socket
|
|
458
462
|
|
|
459
463
|
for (let i = 0; i < sockets.length; i++) {
|
|
464
|
+
if (!sockets[i])
|
|
465
|
+
continue
|
|
466
|
+
|
|
460
467
|
const authorized = await this.authorize.check(data, sockets[i].user_id)
|
|
461
468
|
if (authorized && authorized.authorized)
|
|
462
469
|
sockets[i].send(JSON.stringify(authorized.authorized));
|