@cocreate/socket-server 1.24.0 → 1.24.1

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,10 @@
1
+ ## [1.24.1](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.24.0...v1.24.1) (2023-12-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * async await upgrade to handle authenticate ([e6416f5](https://github.com/CoCreate-app/CoCreate-socket-server/commit/e6416f5725ece424b69a142b70de4a0ca6687869))
7
+
1
8
  # [1.24.0](https://github.com/CoCreate-app/CoCreate-socket-server/compare/v1.23.0...v1.24.0) (2023-11-25)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/socket-server",
3
- "version": "1.24.0",
3
+ "version": "1.24.1",
4
4
  "description": "CoCreate-socket-server",
5
5
  "keywords": [
6
6
  "cocreate-socket",
package/src/index.js CHANGED
@@ -30,7 +30,7 @@ class SocketServer extends EventEmitter {
30
30
  let organization_id = request.url.split('/')
31
31
  organization_id = organization_id[organization_id.length - 1]
32
32
 
33
- this.wss.handleUpgrade(request, socket, head, function (socket) {
33
+ this.wss.handleUpgrade(request, socket, head, async function (socket) {
34
34
  if (organization_id) {
35
35
  let organization = self.organizations.get(organization_id)
36
36
  if (organization && organization.status === false) {
@@ -87,7 +87,7 @@ class SocketServer extends EventEmitter {
87
87
  self.emit('object.read', data);
88
88
 
89
89
  if (self.authenticate) {
90
- const { user_id, expires } = self.authenticate.decodeToken(options.token)
90
+ const { user_id, expires } = await self.authenticate.decodeToken(options.token, organization_id, options.clientId)
91
91
  const userStatus = { socket, method: 'userStatus', user_id: options.user_id, clientId: options.clientId, userStatus: 'off', organization_id }
92
92
  if (user_id) {
93
93
  options.user_id = user_id