@cocreate/socket-server 1.4.31 → 1.4.33

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 CHANGED
@@ -1,3 +1,18 @@
1
+ ## [1.4.33](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.4.32...v1.4.33) (2022-12-21)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bump dependencies ([0d0d214](https://github.com/CoCreate-app/CoCreate-socket-server/commit/0d0d214e741e987a9ef28417f5d5d9b004876bf0))
7
+ * reduce message userStatus ([4f9ba84](https://github.com/CoCreate-app/CoCreate-socket-server/commit/4f9ba847cd7cfa684f898907fdca58308b54484d))
8
+
9
+ ## [1.4.32](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.4.31...v1.4.32) (2022-12-20)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * bump dependencies ([caa7eec](https://github.com/CoCreate-app/CoCreate-socket-server/commit/caa7eec54b9d8933650d5eea8355d5bcef725f24))
15
+
1
16
  ## [1.4.31](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.4.30...v1.4.31) (2022-12-13)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/socket-server",
3
- "version": "1.4.31",
3
+ "version": "1.4.33",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
@@ -40,8 +40,8 @@
40
40
  },
41
41
  "homepage": "https://cocreate.app/docs/CoCreate-socket-server",
42
42
  "dependencies": {
43
- "@cocreate/docs": "^1.4.19",
44
- "@cocreate/uuid": "^1.2.38"
43
+ "@cocreate/docs": "^1.4.21",
44
+ "@cocreate/uuid": "^1.2.42"
45
45
  },
46
46
  "devDependencies": {
47
47
  "express": "^4.17.1",
package/src/index.js CHANGED
@@ -64,6 +64,7 @@ class SocketServer extends EventEmitter{
64
64
 
65
65
  addClient(socket) {
66
66
  let organization_id = socket.config.organization_id
67
+ let user_id = socket.config.user_id
67
68
  let key = socket.config.key
68
69
  let room_clients = this.clients.get(key);
69
70
  if (room_clients) {
@@ -78,7 +79,10 @@ class SocketServer extends EventEmitter{
78
79
  if (!asyncMessage) {
79
80
  this.asyncMessages.set(key, new AsyncMessage(key));
80
81
  }
81
-
82
+
83
+ if (user_id)
84
+ this.emit('userStatus', socket, {user_id, userStatus: 'on', organization_id});
85
+
82
86
  //. add metrics
83
87
  let total_cnt = 0;
84
88
  this.clients.forEach((c) => total_cnt += c.length)
@@ -157,8 +161,8 @@ class SocketServer extends EventEmitter{
157
161
  if (user_id) {
158
162
  if (!socket.config.user_id ) {
159
163
  socket.config.user_id = user_id
164
+ this.emit('userStatus', socket, {user_id, userStatus: 'on', organization_id});
160
165
  }
161
- this.emit('userStatus', socket, {user_id, userStatus: 'on', organization_id});
162
166
  }
163
167
 
164
168
  //. checking async status....