Files
SerpentRace/SerpentRace_Backend/dist/Application/Services/WebSocketService.d.ts
T

66 lines
2.2 KiB
TypeScript

import { Server as HttpServer } from 'http';
import { ChatAggregate } from '../../Domain/Chat/ChatAggregate';
export declare class WebSocketService {
private io;
private jwtService;
private chatRepository;
private chatArchiveRepository;
private userRepository;
private redisService;
private connectedUsers;
private chatTimeout;
private maxMessagesPerUser;
private messageCleanupWeeks;
private userMessageCounts;
constructor(httpServer: HttpServer);
private initializeRedis;
private setupSocketHandlers;
private handleConnection;
private handleJoinChat;
private handleLeaveChat;
private handleSendMessage;
private handleCreateGroup;
private handleCreateDirectChat;
private handleCreateGameChat;
private handleGetChatHistory;
private handleDeleteChat;
private handleDeleteChatArchive;
private handleDeleteMessage;
private handleDisconnection;
private calculateUnreadMessages;
private pruneMessages;
private notifyOfflineUsers;
private setupArchivingScheduler;
createGameChat(gameId: string, gameName: string, playerIds: string[]): Promise<ChatAggregate | null>;
getConnectedUserCount(): number;
isUserConnected(userId: string): boolean;
cleanup(): Promise<void>;
/**
* Manually trigger cleanup of old messages and chats
* This can be called by admin endpoints for maintenance
*/
triggerManualCleanup(): Promise<{
deletedArchives: number;
deletedChats: number;
}>;
/**
* Clean up old messages from archived chats based on messageCleanupWeeks setting
*/
private cleanupOldMessages;
/**
* Check if user has exceeded message rate limit
* @param userId User ID to check
* @returns true if within limit, false if exceeded
*/
private checkMessageRateLimit;
/**
* Delete a specific message from chat history
* This can be used for moderation purposes
*/
deleteMessage(chatId: string, messageId: string, moderatorUserId: string): Promise<boolean>;
/**
* Clean up old user message count entries (called periodically)
*/
private cleanupMessageCounts;
}
//# sourceMappingURL=WebSocketService.d.ts.map