Skip to content

Commit 2cff70e

Browse files
committed
fix(socket): wait for endpoint init
1 parent 4acf024 commit 2cff70e

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/socket.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const getPrivileges = async(type: 'admin' | 'viewer' | 'public', userId: string)
4848
}
4949
};
5050

51-
const initEndpoints = async(socket: SocketIO, privileges: Unpacked<ReturnType<typeof getPrivileges>>) => {
51+
const initEndpoints = (socket: SocketIO, privileges: Unpacked<ReturnType<typeof getPrivileges>>) => {
5252
for (const key of [...new Set(endpoints.filter(o => o.nsp === socket.nsp.name).map(o => o.nsp + '||' + o.on))]) {
5353
const [nsp, on] = key.split('||');
5454
const endpointsToInit = endpoints.filter(o => o.nsp === nsp && o.on === on);
@@ -230,7 +230,7 @@ class Socket extends Core {
230230
setTimeout(() => socket.emit('forceDisconnect'), 1000); // force disconnect if we must be logged in
231231
}
232232
}
233-
next();
233+
setTimeout(() => next(), 100);
234234
}
235235

236236
sockets () {

0 commit comments

Comments
 (0)