This section introduces the three foundational processes that define how the client connects to a chat server: discovery, authentication, and connection establishment.
These steps are performed in sequence and drive the application lifecycle, resulting in one or more independent chat windows — each powered by its own ClientManager instance.
Note: Discovery and authentication always occur in the main window. Chat windows are only created after a valid access token is received.
Discovery begins the client session. When the user enters a server URL, the DiscoveryManager retrieves server metadata such as WebSocket and OAuth endpoints. This data is required to initialize both the authentication flow and the later WebSocket connection.
Authentication uses OAuth2 via an embedded browser. Once the discovery metadata is loaded, an AuthManager is created and presented alongside the browser. When authentication completes, an access token is emitted and handed off to the connection layer.
After authentication, a new chat window is created. It owns a ClientManager instance which establishes a WebSocket connection using the discovered endpoints and received token. This manager handles real-time messaging and exposes filtered models for QML binding.
After connection, the WebsocketManager relays incoming server messages to the MessageBroker, which parses them into structured payloads and updates internal message models.
ClientManager exposes filtered proxy models for each channel and private conversation, allowing QML views to bind to isolated message streams within a session context.