websocket-chat / dist /services /RoomManager.d.ts
harsh-dev's picture
rename fix
3a72b90 unverified
raw
history blame contribute delete
784 Bytes
import WebSocket from 'ws';
export declare class RoomManager {
private rooms;
constructor();
/**
* Adds a user to a specific room.
* Creates the room if it doesn't exist.
*/
joinRoom(roomId: string, username: string, socket: WebSocket): void;
renameUser(roomId: string, username: string, newUsername: string, socket: WebSocket): boolean;
/**
* Removes a user from a room.
* Cleans up the room if it becomes empty.
*/
leaveRoom(roomId: string, username: string): boolean;
/**
* Checks if a room exists.
*/
hasRoom(roomId: string): boolean;
/**
* Sends a message to all users in a specific room.
*/
broadcast(roomId: string, message: string): void;
}
//# sourceMappingURL=RoomManager.d.ts.map