This document provides an overview of the available endpoints in the Mirage server. Each endpoint serves a specific purpose related to chat room management and messaging.
You can check the complete list of endpoints in the Mirage server code here.
- Type: Socket.IO event
- Description: Triggered when a client connects to the server.
- Parameters:
sid
(Session ID)environ
(Environment dictionary)
- Usage: Connection setup for clients.
- Type: Socket.IO event
- Description: Triggered when a client disconnects from the server.
- Parameters:
sid
(Session ID)
- Usage: Handle client disconnections.
- Type: Socket.IO event
- Description: Fetches the list of rooms that the current user has joined.
- Parameters:
sid
(Session ID)
- Usage: Returns a list of rooms specific to the connected user.
- Type: Socket.IO event
- Description: Creates a new room with the given name and adds the creator.
- Parameters:
sid
(Session ID)data
(Includesroom_name
andusername
)
- Usage: Users can create a new room; checks if the room already exists.
- Type: Socket.IO event
- Description: Allows a user to join an existing room.
- Parameters:
sid
(Session ID)data
(Includesusername
androom_name
)
- Usage: Adds the user to the specified room.
- Type: Socket.IO event
- Description: Allows a user to leave a room.
- Parameters:
sid
(Session ID)data
(Includesusername
androom_name
)
- Usage: Removes the user from the specified room.
- Type: Socket.IO event
- Description: Returns a list of users currently in the specified room.
- Parameters:
sid
(Session ID)data
(Includesroom_name
)
- Usage: Retrieves user information for a room.
- Type: Socket.IO event
- Description: Sends a message to the specified room.
- Parameters:
sid
(Session ID)data
(Includesusername
,room_name
, andmessage
)
- Usage: Adds the message to the room's list and emits the message to all users.
- Type: Socket.IO event
- Description: Retrieves messages from a room starting after the specified message ID.
- Parameters:
sid
(Session ID)data
(Includesroom_name
andlast_message_id
)
- Usage: Fetches new messages for the client, based on the last seen message ID.
- Type: Socket.IO event
- Description: Retrieves all messages for the specified room.
- Parameters:
sid
(Session ID)data
(Includesroom_name
)
- Usage: Sends all previous messages for the room to the client.
- Type: Socket.IO event
- Description: Retrieves server statistics, such as total and today’s pings.
- Parameters:
sid
(Session ID)
- Usage: Shows server usage metrics.
For storing messages on the client-side, you could ask users to allow local storage from their browser, enabling messages to be saved locally even after server restarts. This helps improve user experience without involving server-side message storage.