@cocreate/socket-server 1.28.1 → 1.28.2
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 +7 -0
- package/package.json +1 -1
- package/src/index.js +13 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [1.28.2](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.28.1...v1.28.2) (2024-02-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* data.socket removal before sending ([ed9b6a1](https://github.com/CoCreate-app/CoCreate-socket-server/commit/ed9b6a19e8da58a48f5eabd44b2419cc13f3c433))
|
|
7
|
+
|
|
1
8
|
## [1.28.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.28.0...v1.28.1) (2024-02-05)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -460,6 +460,7 @@ class SocketServer extends EventEmitter {
|
|
|
460
460
|
} else {
|
|
461
461
|
const sent = []
|
|
462
462
|
|
|
463
|
+
//TODO: get socket using clientId if socket has been deleted from data
|
|
463
464
|
const authorized = await this.authorize.check(data, socket.user_id)
|
|
464
465
|
if (authorized && authorized.authorized)
|
|
465
466
|
data = authorized.authorized
|
|
@@ -478,21 +479,27 @@ class SocketServer extends EventEmitter {
|
|
|
478
479
|
|
|
479
480
|
let sockets = this.get(data);
|
|
480
481
|
|
|
481
|
-
delete data.socket
|
|
482
|
+
// delete data.socket
|
|
482
483
|
|
|
483
484
|
for (let i = 0; i < sockets.length; i++) {
|
|
484
485
|
if (!sockets[i])
|
|
485
486
|
continue
|
|
486
487
|
|
|
487
488
|
const authorized = await this.authorize.check(data, sockets[i].user_id)
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
489
|
+
let Data
|
|
490
|
+
if (authorized && authorized.authorized) {
|
|
491
|
+
Data = { ...authorized.authorized }
|
|
492
|
+
} else {
|
|
493
|
+
Data = { ...data }
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
delete Data.socket
|
|
497
|
+
sockets[i].send(JSON.stringify(Data));
|
|
498
|
+
|
|
492
499
|
sent.push(socket.clientId)
|
|
493
500
|
this.emit("setBandwidth", {
|
|
494
501
|
type: 'out',
|
|
495
|
-
data:
|
|
502
|
+
data: Data,
|
|
496
503
|
organization_id: socket.organization_id
|
|
497
504
|
})
|
|
498
505
|
}
|