Overview
The chat system (osu.Game/Online/Chat/) manages all player communication, including:
- Public channels (#osu, #lobby, etc.)
- Private messages (PMs)
- Multiplayer room chat
- Spectator chat
- Team channels
- Command processing
- Link formatting and parsing
Chat uses WebSocket-based communication for real-time message delivery with automatic reconnection handling.
Channel Types
Implemented inosu.Game/Online/Chat/ChannelType.cs:6:
Available Channel Types
Channel Categories
- Public - Open channels anyone can join (#osu, #lobby)
- Private - Invite-only channels
- PM - One-on-one private messaging
- Group - Group private messages
- Multiplayer - Match-specific chat rooms
- Spectator - Chat for spectating sessions
- Temporary - Short-lived event channels
- Team - Team-based communication
- System - System announcements
- Announce - Announcement channels
Channel Management
TheChannelManager handles all channel operations:
Default Channels
Players automatically join these channels on startup:#lazer- osu!lazer discussion#osu- General osu! chat#lobby- Multiplayer lobby
osu.Game/Online/Chat/ChannelManager.cs:28
Channel Operations
Channel Actions
- OpenChannel(name) - Open or switch to a channel by name
- OpenPrivateChannel(user) - Start a PM conversation
- JoinChannel(channel) - Join a new channel
- LeaveChannel(channel) - Exit a channel
- JoinLastClosedChannel() - Reopen the most recently closed channel
- MarkChannelAsRead(channel) - Mark all messages as read
Channel History
The system maintains a history of recently closed channels (up to 50):Message System
Messages are represented by theMessage class with support for multiple message types:
Message Types
- Message - Standard chat message
- LocalMessage - Client-side only messages
- LocalEchoMessage - Pending messages awaiting server confirmation
- InfoMessage - System information messages
- ErrorMessage - Error notifications
osu.Game/Online/Chat/Message.cs:14
Message Properties
Message Data
- Id - Unique message identifier (server-assigned)
- ChannelId - Channel the message belongs to
- Content - Raw message text
- DisplayContent - Formatted text for display
- Sender - User who sent the message
- SenderId - Sender’s user ID
- Timestamp - When the message was sent
- IsAction - Whether this is an action message (/me)
- Uuid - Client-generated UUID for deduplication
- Links - Parsed links within the message
Message Formatting
TheMessageFormatter automatically processes message content to create clickable links:
Supported Link Formats
Implemented inosu.Game/Online/Chat/MessageFormatter.cs:14:
Link Types
- Beatmap links -
https://osu.ppy.sh/b/1234orosu://b/1234 - Beatmapset links -
https://osu.ppy.sh/beatmapsets/1234 - User profiles -
https://osu.ppy.sh/u/username - Wiki pages -
[[Article Name]]→ wiki link - Channels -
#osu→ channel link - Timestamps -
00:12:345→ editor timestamp - Multiplayer rooms -
https://osu.ppy.sh/multiplayer/rooms/1234 - Spectate links -
osu://spectate/username - Markdown links -
[text](url) - Old format -
(text)[url]and[url text] - External URLs - Standard HTTP/HTTPS links
Link Actions
Clicking formatted links triggers specific actions:Links are automatically parsed and styled with proper security warnings for external URLs.
Chat Commands
The system supports several built-in commands:Available Commands
Command List
- /help - Display list of supported commands
- /me [action] - Send an action message
- /np - Share currently playing beatmap
- /join [channel] - Join a public channel
- /chat [user] - Open PM with a user
- /msg [user] - Alias for /chat
- /query [user] - Alias for /chat
ChannelManager.cs:254
Command Processing
Commands are processed locally and may trigger:- API requests (user lookup, channel joining)
- State changes (opening new channels)
- Local messages (help text, errors)
Message Queue
Messages are sent through a sequential queue system:- Messages are sent in order
- No race conditions between multiple messages
- Proper handling of PM channel creation
- Error recovery for failed sends
Message History
Each channel maintains a message history with automatic pruning:osu.Game/Online/Chat/Channel.cs:21:
- Messages stored in sorted list
- Automatic purging when exceeding limit
- Pending messages never purged
- Local echo messages tracked separately
Local Echo System
When sending messages, a local echo appears immediately:- Client creates
LocalEchoMessage - Message added to channel (visible instantly)
- Request sent to server
- Server response replaces local echo with real message
- If failed, local echo is removed
User Presence
The chat system tracks user online status:Acknowledgment System
Every 60 seconds, the client sends an ACK request to:- Mark user as online
- Receive messages from public channels
- Get silenced user updates
- Maintain connection state
ChannelManager.cs:405
Players must send ACK at least once every 10 minutes to remain visibly online in chat.
Message Filtering
The system automatically filters messages:Block List Integration
- Blocked users’ messages hidden automatically
- Silenced users’ messages removed from all channels
- Real-time updates when block list changes
Chat Notifications
TheMessageNotifier component handles:
- New message notifications
- Mention highlighting
- Sound alerts
- Desktop notifications
- Badge counters for unread messages
WebSocket Communication
Chat usesWebSocketChatClient for real-time messaging:
WebSocket Features
- Automatic reconnection on disconnect
- Message queuing during offline periods
- Presence updates via WebSocket events
- Channel join/part notifications
- Real-time message delivery
osu.Game/Online/Chat/WebSocketChatClient.cs
Unread Messages
Each channel tracks unread messages:LastReadId- Last message ID the user has readLastMessageId- Most recent message in channel- Automatic marking when channel is focused
- Server synchronization via MarkChannelAsRead API
Message Limits
Channels have configurable message length limits:- Channel type
- User permissions
- Server configuration
Message Events
Channels expose events for message updates:- UI updates when messages arrive
- Scroll position management
- Notification triggers
- Message animation timing