Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
4e23c46
add NoContent code
dorin-ga Mar 13, 2026
4079ca9
handle code 204 as success
dorin-ga Mar 13, 2026
f2aa42d
treat code 204 as valid response
dorin-ga Mar 13, 2026
1849945
allow 204 for sdk error event
dorin-ga Mar 16, 2026
7911d53
add response code constants
dorin-ga Mar 16, 2026
58c5ed8
print correct status code
dorin-ga Mar 16, 2026
2b08477
http interface
dorin-ga Mar 18, 2026
913e16c
default http implementation
dorin-ga Mar 18, 2026
d592130
use http impl
dorin-ga Mar 18, 2026
ec57ac4
changes to processRequestResponse
dorin-ga Mar 19, 2026
ae729b3
fix debug logs
dorin-ga Mar 19, 2026
bf5af41
add virtual dtor for http api
dorin-ga Mar 23, 2026
c26dcb1
add enum for sdk error
dorin-ga Mar 23, 2026
763df97
simplify code
dorin-ga Mar 23, 2026
0185451
sanity check for impl
dorin-ga Mar 23, 2026
d095251
return error is response code is invalid
dorin-ga Apr 1, 2026
e086082
missing return code
dorin-ga Apr 1, 2026
24090ca
fix: check response status before parsing JSON in init request
Gogoshika-ga Apr 2, 2026
997bb0a
Fix: Early-return an empty string_view when packet is empty.
Gogoshika-ga Apr 2, 2026
d544623
fix: use correct format specifier %ld for status code log
Gogoshika-ga Apr 2, 2026
b932426
move GAHttpWrapper to public include and allow registering a custom H…
Gogoshika-ga Apr 2, 2026
029ce47
add HTTP interface tests and README documentation
Gogoshika-ga Apr 2, 2026
b7af985
fix MSVC min macro conflict in GAUtilities
Gogoshika-ga Apr 2, 2026
1761269
update github actions to prevent node.js warnings
Gogoshika-ga Apr 2, 2026
ab2563b
rename GAHttpWrapper to GAHttpClient
Gogoshika-ga Apr 2, 2026
a3dc128
fix NOMINMAX for windows
Gogoshika-ga Apr 2, 2026
ed98ecf
return proper error codes
dorin-ga Apr 2, 2026
0df8c95
require a valid http client only after initialization
dorin-ga Apr 20, 2026
4e2d068
initialize http client when calling init
dorin-ga Apr 20, 2026
0073f0e
change to public interface for http client
dorin-ga Apr 20, 2026
d0c2475
add vcpkg support
dorin-ga Apr 22, 2026
3452f3b
modify cmake to use vcpkg
dorin-ga Apr 22, 2026
fc80df5
remove prebuilt libraries, use vcpkg instead
dorin-ga Apr 22, 2026
1ab09d8
vcpkg support
dorin-ga Apr 22, 2026
dd0b29f
add vcpkg to workflow
dorin-ga Apr 22, 2026
3dc87a8
option to use vcpkg in cmake
dorin-ga Apr 22, 2026
61f67af
moved toolchain file to cmake
dorin-ga Apr 22, 2026
5931ce4
fix triplet generation
dorin-ga Apr 22, 2026
f174143
set flag if the client has already been initialized
dorin-ga Apr 22, 2026
92c30b8
assure client is initialized from the calling thread
dorin-ga Apr 22, 2026
b3e4c00
move http client initialization on init
dorin-ga Apr 22, 2026
be5c117
use curl with openssl
dorin-ga Apr 23, 2026
4561d94
triplet detection for vcpkg
dorin-ga Apr 23, 2026
e93337f
fix triplet
dorin-ga Apr 23, 2026
1f6c55c
fix triplet
dorin-ga Apr 23, 2026
6a2366a
update vcpkg baseline
dorin-ga Apr 23, 2026
5829755
detect cmake osx architecture
dorin-ga Apr 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
c_compiler: gcc

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

Expand All @@ -79,7 +79,7 @@ jobs:
fi

- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.x'

Expand All @@ -99,6 +99,24 @@ jobs:
echo "check lld..."
ldd --version

- name: Install vcpkg (Linux/macOS)
if: runner.os != 'Windows'
shell: bash
run: |
git clone https://github.com/microsoft/vcpkg.git "$HOME/vcpkg"
"$HOME/vcpkg/bootstrap-vcpkg.sh" -disableMetrics
echo "VCPKG_ROOT=$HOME/vcpkg" >> "$GITHUB_ENV"
echo "$HOME/vcpkg" >> "$GITHUB_PATH"

- name: Install vcpkg (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg.git "$env:USERPROFILE\vcpkg"
& "$env:USERPROFILE\vcpkg\bootstrap-vcpkg.bat" -disableMetrics
echo "VCPKG_ROOT=$env:USERPROFILE\vcpkg" >> $env:GITHUB_ENV
echo "$env:USERPROFILE\vcpkg" >> $env:GITHUB_PATH

- name: Build, Test, and Package with setup.py
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
submodules: true

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/create_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
fetch-depth: 0 # Fetch all history for tags and commits

Expand Down
38 changes: 14 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ option(ENABLE_COVERAGE "Enable code coverage reporting" OFF)
option(GA_SHARED_LIB "Build GA as a shared library" OFF)
option(GA_UWP_BUILD "Build GA for UWP (if targeting windows)" OFF)
option(GA_BUILD_SAMPLE "Builds the GA Sample app" ON)
option(GA_USE_PACKAGE "Use installed packages for dependencies" OFF)
option(GA_USE_PACKAGE "Use installed packages for dependencies" ON)
option(USE_VCPKG "Install dependencies from VCPKG" ON)

# set directories
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/Debug")
Expand All @@ -34,6 +35,12 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)

if(${USE_VCPKG})
# set cmake
include("$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
# set toolchain file
set(CMAKE_TOOLCHAIN_FILE, "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
endif()

include_directories(
# gameanalytics includes
Expand All @@ -49,8 +56,6 @@ include_directories(
"${DEPENDENCIES_DIR}/sqlite"
"${DEPENDENCIES_DIR}/crypto"
"${DEPENDENCIES_DIR}/miniz"
"${EXTERNALS_DIR}/curl/include"
"${EXTERNALS_DIR}/openssl/include"
)

FILE(GLOB_RECURSE CPP_SOURCES
Expand Down Expand Up @@ -136,28 +141,13 @@ endif()

# --------------------------- Settings --------------------------- #

if(${GA_USE_PACKAGE})

find_package(CURL REQUIRED PATHS ${EXTERNALS_DIR}/curl)
find_package(OpenSSL REQUIRED PATHS ${EXTERNALS_DIR}/openssl)
set(LIBS CURL::libcurl)

else()

add_definitions("-DUSE_OPENSSL -DCURL_STATICLIB -DCRYPTOPP_DISABLE_ASM")
find_package(OpenSSL REQUIRED)
find_package(CURL REQUIRED)

link_directories(
"${EXTERNALS_DIR}/openssl/1.1.1d/libs/${PLATFORM}"
"${EXTERNALS_DIR}/curl/lib/${PLATFORM}"
)

if(WIN32)
set(LIBS libcurl.lib libeay32.lib ssleay32.lib)
else()
set(LIBS libcurl.a libssl.a libcrypto.a)
endif()

endif()
set(LIBS
CURL::libcurl
OpenSSL::SSL
OpenSSL::Crypto)

if(${GA_SHARED_LIB})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGA_SHARED_LIB")
Expand Down
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,58 @@ void myLogHandler(const char* message, GALoggerMessageType type)
gameAnalytics_configureCustomLogHandler(myLogHandler);
```

### Custom HTTP client

By default, the SDK uses cURL for HTTP requests. If you need to use a different HTTP library (e.g. on consoles or custom platforms), you can provide your own implementation by subclassing `GAHttpClient`:

``` c++
#include "GameAnalytics/GAHttpClient.h"

class MyHttpClient : public gameanalytics::GAHttpClient
{
public:
void initialize() override
{
// Set up your HTTP library
}

void cleanup() override
{
// Tear down your HTTP library
}

Response sendRequest(
std::string const& url,
std::string const& auth,
std::vector<uint8_t> const& payloadData,
bool useGzip,
void* userData) override
{
Response response;

// Use your HTTP library to POST payloadData to url.
// Set the following headers:
// - auth (e.g. "Authorization: ...")
// - "Content-Type: application/json"
// - "Content-Encoding: gzip" (if useGzip is true)
//
// Fill in response.code with the HTTP status code.
// Fill in response.packet with the response body bytes.

return response;
}
};
```

Register it **before** calling `initialize()`:

``` c++
gameanalytics::GameAnalytics::configureHttpClient(std::make_unique<MyHttpClient>());
gameanalytics::GameAnalytics::initialize("<your game key>", "<your secret key>");
```

If `configureHttpClient` is not called, the built-in cURL implementation is used.

### Configuration

Example:
Expand Down
Loading
Loading