RoomController

class RoomController(dataSource: DataSource)

Controller for handling chat room operations.

Constructors

Link copied to clipboard
constructor(dataSource: DataSource)

Functions

Link copied to clipboard
suspend fun disconnect(username: String)

Disconnects a member by closing its WebSocket session.

Link copied to clipboard
suspend fun getAllMessages(from: String?): List<Message>

Retrieves all chat messages for the specified user.

Link copied to clipboard
fun onJoin(username: String, sessionId: String, socket: WebSocketSession)

Handles the join event of a room member.

Link copied to clipboard
suspend fun sendMessage(senderUsername: String, message: String)

Sends a message to all members in the chat room.