vn-verdnaturachat/app/lib/methods/subscribeRooms.ts

19 lines
386 B
TypeScript

import log from '../../utils/log';
import subscribeRoomsTmp, { roomsSubscription } from './subscriptions/rooms';
export async function subscribeRooms(): Promise<void> {
if (!roomsSubscription?.stop) {
try {
await subscribeRoomsTmp();
} catch (e) {
log(e);
}
}
}
export function unsubscribeRooms(): void {
if (roomsSubscription?.stop) {
roomsSubscription.stop();
}
}