Provides a high-level interface for initiating discovery requests. More...
Header: | #include <DiscoveryManager> |
Inherits: | QObject |
DiscoveryManager(QObject *parent = nullptr) | |
void | discover(const QString urlString) |
void | discoveryFailed(const QString &error) |
void | discoverySuccess(const DiscoveryPayload &payload) |
The DiscoveryManager is responsible for initiating the server discovery process using a URL. It emits signals to indicate success or failure. It wraps DiscoveryCore to perform the actual network request and JSON parsing.
Note: The DiscoveryManager is intended to be used from QML and exposes a discover()
method that takes a string-formatted URL. When the request finishes, it emits either discoverySuccess
or discoveryFailed
depending on the result.
See also DiscoveryCore, DiscoveryPayload, and DiscoveryPage.
[explicit]
DiscoveryManager::DiscoveryManager(QObject *parent = nullptr)Constructs the DiscoveryManager.
parent is the optional QObject parent.
Sets up internal signal connections between DiscoveryCore and this manager.
[invokable]
void DiscoveryManager::discover(const QString urlString)Begins the discovery process using the given urlString.
This method initiates a network request to the provided URL string, attempting to retrieve and parse discovery metadata from a remote chat server.
Upon success, the discoverySuccess signal is emitted with the resulting DiscoveryPayload. If an error occurs, the discoveryFailed signal is emitted with a description of the failure.
Note: Only one request is active at a time. Calling this while a previous request is ongoing will cancel the prior request.
Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.
[signal]
void DiscoveryManager::discoveryFailed(const QString &error)Emitted when discovery fails due to a network or parsing error.
This signal is emitted when the discovery request cannot complete successfully. The error string describes the reason for the failure (e.g., connection refused or invalid format).
[signal]
void DiscoveryManager::discoverySuccess(const DiscoveryPayload &payload)Emitted when the discovery process completes successfully.
This signal is emitted after a successful request to a discovery endpoint. The payload contains the server's metadata used to configure the client.