Skip to content

Commit e6416f5

Browse files
committed
fix: async await upgrade to handle authenticate
1 parent bcee13f commit e6416f5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SocketServer extends EventEmitter {
3030
let organization_id = request.url.split('/')
3131
organization_id = organization_id[organization_id.length - 1]
3232

33-
this.wss.handleUpgrade(request, socket, head, function (socket) {
33+
this.wss.handleUpgrade(request, socket, head, async function (socket) {
3434
if (organization_id) {
3535
let organization = self.organizations.get(organization_id)
3636
if (organization && organization.status === false) {
@@ -87,7 +87,7 @@ class SocketServer extends EventEmitter {
8787
self.emit('object.read', data);
8888

8989
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)
9191
const userStatus = { socket, method: 'userStatus', user_id: options.user_id, clientId: options.clientId, userStatus: 'off', organization_id }
9292
if (user_id) {
9393
options.user_id = user_id

0 commit comments

Comments
 (0)