Overview
Mirage allows you to create both public and private chat rooms for real-time communication. This guide walks you through room creation, joining rooms, and managing room messages.Mirage limits public rooms to 5 maximum per instance. Private rooms have no limit.
Creating a Chat Room
Authenticate your request
All room operations require a valid authentication token in the
Authorization header.Send room creation request
Create a room by sending a POST request to
/api/create_room with the room details.Creating Private Rooms
Private rooms require a password and bypass the 5-room public limit.Passwords are hashed using SHA-256 before storage. See
app/utils.py:9 for the implementation.Password Requirements
- Required for private rooms (returns
400if missing) - Stored as SHA-256 hash
- Cannot be empty or whitespace-only
Public Room Limit
Mirage enforces a maximum of 5 public rooms system-wide to encourage focused discussions.Joining Existing Rooms
Join Room Error Codes
| Status Code | Error | Description |
|---|---|---|
400 | Missing room name or token | Required fields not provided |
401 | Unauthorized | Invalid authentication token |
403 | Password required | Private room accessed without password |
403 | Wrong password | Incorrect password for private room |
404 | Room not found | Room doesn’t exist |
Sending Messages
Once you’re a member of a room, you can send messages.You must be a member of the room to send messages. The system verifies membership in
app/routes/chat.py:146-149.Message Constraints
Messages have built-in lifecycle management:- Maximum messages: 100 stored in memory (
MAX_MESSAGESinapp/config.py:5) - Message lifespan: 30 minutes (
MESSAGE_LIFESPAN = 60 * 30 * 30inapp/config.py:6) - Oldest messages are removed when limit is exceeded
- Messages older than lifespan are automatically pruned
Retrieving Messages
Fetch all messages for a room you’re a member of.Managing Room Members
View Room Members
Get a list of all members in a room.View Your Rooms
Get all rooms you’re currently a member of, including both public and private rooms.Database Schema
Understanding the underlying schema helps with advanced integrations.Room Tables Schema
Room Tables Schema
Best Practices
Use Private Rooms
When the 5 public room limit is reached, create private rooms for team discussions.
Descriptive Names
Use clear, descriptive room names to help users find relevant conversations.
Password Strength
Use strong passwords for private rooms to prevent unauthorized access.
Monitor Membership
Regularly check room members to ensure appropriate access.
Common Issues
Room creation fails with 'room already exists'
Room creation fails with 'room already exists'
Room names must be globally unique. Try a different name or check if someone else created a room with that name.
Can't create more public rooms
Can't create more public rooms
The system has a hard limit of 5 public rooms. Either:
- Create a private room instead
- Wait for an existing public room to be deleted
- Contact the administrator to remove unused rooms
Messages not appearing
Messages not appearing
Messages older than 30 minutes are automatically pruned. If you sent a message more than 30 minutes ago, it may have been removed from the in-memory store.
Can't join private room
Can't join private room
Ensure you’re providing the correct password. Passwords are case-sensitive and must match exactly.
Next Steps
File Sharing
Learn how to share files in chat rooms
Privacy Settings
Configure privacy settings for your account