libHttpClient provides a platform abstraction layer for HTTP and WebSocket, and is designed for use by the Microsoft Xbox Live Service API (XSAPI) [https://github.com/Microsoft/xbox-live-api] and game devs. If you want to contribute to the project, please talk to us to avoid overlap.
Перейти к файлу
Sasha Weiss 0151cbffeb
Update path casing for Android Java files to align with package name (#567)
* Temporarily rename java path to junk

* Rename back with better casing

* Temporarily rename java path to junk for VS builds

* Rename back with better casing

* Change casing in .androidproj files

* Empty commit to bump CI

* Second empty commit to bump CI
2021-03-02 15:48:07 -08:00
Build Update path casing for Android Java files to align with package name (#567) 2021-03-02 15:48:07 -08:00
External Moving from asio 1.12.0 to 1.12.2 to fix build break with Xcode 10.2. (#393) 2019-03-28 19:01:28 -07:00
Include Updating the headers to match the docs chm (#555) 2021-01-08 12:16:34 -08:00
Samples Fixup the 2019 solution (#483) 2019-11-07 11:36:19 -08:00
Source Make WinHttp WebSocket send fully asyncronous (#561) 2021-02-11 20:53:03 -08:00
Tests Fix random FAIL_FAST and async context corruption in XAsyncGetResults (#514) 2020-05-03 01:25:47 -07:00
Utilities openssl.bash: Use Xcode instance preferred by caller (#564) 2021-02-17 14:34:31 -08:00
.gitattributes Init 2017-06-12 00:31:32 -07:00
.gitignore Add modern Gradle+CMake Android builds (#518) 2020-05-28 20:02:54 -07:00
.gitmodules Adding Asio and openssl source, fixing props file (#232) 2018-08-06 12:41:06 -07:00
CONTRIBUTING.md Init 2017-06-12 00:31:32 -07:00
LICENSE.md Init 2017-06-12 00:31:32 -07:00
README.md Updating to latest API naming convention (#356) 2019-01-10 15:07:57 -08:00
ThirdPartyNotices.txt Adding 3pp notice file (#309) 2018-10-17 14:35:36 -07:00
build.root Add packagesRoot variable so that package properties are imported bas… (#207) 2018-07-24 15:20:42 -07:00
custom.props Make libhttpclient.props and openssl.props provide MSBuild references to their projects (#248) 2018-08-16 14:09:34 -07:00
libHttpClient.props Adding GDK projects to libHttpClient props file (#552) 2020-11-02 14:10:47 -08:00
libHttpClient.vs2015.sln Adding v140 projects for libssl and libcrypto (#251) 2018-08-20 16:15:43 -07:00
libHttpClient.vs2017.sln Adding GDK projects (#551) 2020-10-30 14:41:05 -07:00
libHttpClient.vs2019.sln Adding GDK projects (#551) 2020-10-30 14:41:05 -07:00
platform_select.props Fixing platform name (#510) 2020-04-09 21:12:39 -07:00

README.md

Welcome!

libHttpClient provides a platform abstraction layer for HTTP and WebSocket, and is designed for use by the Microsoft Xbox Live Service API (XSAPI) and game devs. If you want to contribute to the project, please talk to us to avoid overlap.

Goals

  • libHttpClient provides a platform abstraction layer for HTTP and WebSocket
  • Stock implementations that call native platform HTTP / WebSocket APIs on UWP, XDK ERA, iOS, Android
  • Caller can add support for other platforms via callback API
  • Sample showing off an HTTP implementation via Curl via this callback
  • Designed around the needs of professional game developers that use Xbox Live
  • Will be used by the Microsoft Xbox Live Service API (XSAPI)
  • Builds for UWP, XDK ERA, Win32, iOS, and Android
  • Public API is a flat C API
  • Asynchronous API
  • Public API supports simple P/Invoke without needing to use the "C#/.NET P/Invoke Interop SDK" or C++/CLI
  • Public APIs to manage async tasks
  • Async data can be returned to a specific game thread so the game doesn't need to marshal the data between threads
  • No streams support
  • No dependencies on PPL or Boost
  • Does not throw exceptions as a means of non-fatal error reporting
  • Caller controlled memory allocation via callback API (similar to XDK's XMemAlloc)
  • Built-in logging support to either debug output and/or callback
  • Built in retry support according to Xbox Live best practices (obey Retry-After header, jitter wait, etc) according to https://docs.microsoft.com/en-us/windows/uwp/xbox-live/using-xbox-live/best-practices/best-practices-for-calling-xbox-live#retry-logic-best-practices
  • Xbox Live throttle handling logic
  • Built-in API support to switch to mock layer
  • Open source project on GitHub
  • Binaries eventually on Nuget.org as Nuget packages, and maybe VcPkg
  • Unit tests via TAEF
  • End to end samples for UWP C++, XDK ERA, Win32, iOS, and Android

HTTP API Usage

See public header

  1. Optionally call HCMemSetFunctions() to control memory allocations
  2. Call HCInitialize()
  3. Optionally call HCSettingsSet*()
  4. Call HCHttpCallCreate() to create a new HCCallHandle
  5. Call HCHttpCallRequestSet*() to prepare the HCCallHandle
  6. Call HCHttpCallPerform() to perform an HTTP call using the HCCallHandle.
  7. The perform call is asynchronous, so the work will be done on a background thread which calls DispatchAsyncQueue( ..., AsyncQueueCallbackType_Work ). The results will return to the callback on the thread that calls DispatchAsyncQueue( ..., AsyncQueueCallbackType_Completion ).
  8. Call HCHttpCallResponseGet*() to get the HTTP response of the HCCallHandle
  9. Call HCHttpCallCloseHandle() to cleanup the HCCallHandle
  10. Repeat 4-8 for each new HTTP call
  11. Call HCCleanup() at shutdown before your memory manager set in step 1 is shutdown

Behavior control

  • On UWP, XDK ERA, iOS, and Android, HCHttpCallPerform() will call native platform APIs
  • Optionally call HCSetHttpCallPerformFunction() to do your own HTTP handling using HCHttpCallRequestGet*(), HCHttpCallResponseSet*(), and HCSettingsGet*()
  • See sample CustomHttpImplWithCurl how to use this callback plus Curl to make an HTTP implementation using Curl.

How to clone repo

This repo contains submodules. There are two ways to make sure you get submodules.

When initially cloning, make sure you use the "--recursive" option. i.e.:

git clone --recursive https://github.com/Microsoft/libHttpClient.git

If you already cloned the repo, you can initialize submodules with:

git submodule sync
git submodule update --init --recursive

Note that using GitHub's feature to "Download Zip" does not contain the submodules and will not properly build. Please clone recursively instead.

Contribute Back!

Is there a feature missing that you'd like to see, or have you found a bug that you have a fix for? Or do you have an idea or just interest in helping out in building the library? Let us know and we'd love to work with you. For a good starting point on where we are headed and feature ideas, take a look at our requested features and bugs.

Big or small we'd like to take your contributions back to help improve the libHttpClient for game devs.

Having Trouble?

We'd love to get your review score, whether good or bad, but even more than that, we want to fix your problem. If you submit your issue as a Review, we won't be able to respond to your problem and ask any follow-up questions that may be necessary. The most efficient way to do that is to open a an issue in our issue tracker.

Xbox Live GitHub projects

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.