22#include < chrono>
33#include < iostream>
44#include < random>
5+ #include < string>
56#include < thread>
6-
77using namespace std ;
88using namespace cly ;
99
@@ -30,6 +30,27 @@ void printLog(LogLevel level, const string &msg) {
3030 cout << lvl << msg << endl;
3131}
3232
33+ // // Custom HTTP client
34+ // HTTPResponse customClient(bool use_post, const std::string &path, const std::string &data) {
35+ // HTTPResponse response;
36+ // response.success = false;
37+ // cout << "Will send the request!!" << endl;
38+
39+ // // asynchronous operation
40+ // std::thread requestThread([&response]() {
41+ // std::this_thread::sleep_for(std::chrono::seconds(2)); // network delay
42+ // // you should add extra logic to check if request is successful normally
43+ // response.success = true;
44+ // response.data = R"({"some":"data"})"; // response data
45+ // });
46+
47+ // // Wait for the request to complete
48+ // requestThread.join();
49+ // cout << "Got RESPONSE:[" + response.data.dump() + "]" << endl;
50+
51+ // return response;
52+ // }
53+
3354int main () {
3455 cout << " Sample App" << endl;
3556 Countly &ct = Countly::getInstance ();
@@ -38,13 +59,17 @@ int main() {
3859 // Please refer to the documentation for more information:
3960 // https://support.count.ly/hc/en-us/articles/4416163384857-C-
4061
41- ct.alwaysUsePost (true );
62+ // Custom HTTP client
63+ // HTTPClientFunction clientPtr = customClient;
64+ // ct.setHTTPClient(clientPtr);
65+ // ct.alwaysUsePost(true);
66+
4267 ct.setLogger (printLog);
4368 ct.SetPath (" databaseFileName.db" ); // this will be only built into account if the correct configurations are set
4469 ct.setDeviceID (" test-device-id" );
4570 // ct.setSalt("test-salt");
4671 // OS, OS_version, device, resolution, carrier, app_version);
47- ct.SetMetrics (" Windows 10" , " 10.22" , " Mac" , " 800x600" , " Carrier" , " 1.0" );
72+ // ct.SetMetrics("Windows 10", "10.22", "Mac", "800x600", "Carrier", "1.0");
4873
4974 // start the SDK (initialize the SDK)
5075 string _appKey = " YOUR_APP_KEY" ;
0 commit comments