/* * Copyright (c) 2022. * Author Peter Placzek (tada5hi) * For the full copyright and license information, * view the LICENSE file that was distributed with this source code. */ import {Redis} from "ioredis"; import {RecordStatus} from "../../../../modules/socket/status"; let roomStatus: RecordStatus | undefined; export function useChatRoomStatus(redisDatabase?: Redis) : RecordStatus { if(typeof roomStatus !== 'undefined') { return roomStatus; } if(typeof redisDatabase == 'undefined') { throw new Error('No namespace name injected in room event handlder...'); } roomStatus = new RecordStatus( redisDatabase, { redisPrefix: 'chat', redisSuffix: 'roomUser', recordType: 'user' } ); return roomStatus; }