fix: don't join/leave user channels
This commit is contained in:
parent
7b86158a19
commit
536e9dae2e
|
@ -57,6 +57,7 @@ export function createSocketServer(httpServer) {
|
|||
socketServer.io.use(async (socket, next) => {
|
||||
await Promise.all(
|
||||
(await channelsToHydrate(socket.handshake))
|
||||
.filter(({type}) => 'r' === type)
|
||||
.map((channel) => joinChannel(channel))
|
||||
.map((channel) => userJoin(channel, socket)),
|
||||
);
|
||||
|
@ -90,9 +91,12 @@ export function createSocketServer(httpServer) {
|
|||
});
|
||||
socket.on('disconnecting', async () => {
|
||||
Object.keys(socket.socket.rooms).forEach((room) => {
|
||||
if (parseChannel(`/chat${room}`)) {
|
||||
const parsed = parseChannel(`/chat${room}`);
|
||||
if (parsed) {
|
||||
if ('r' === parsed.type) {
|
||||
userLeave(room, socket);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user