Coder Social home page Coder Social logo

heroiclabs / nakama-cpp Goto Github PK

View Code? Open in Web Editor NEW
69.0 12.0 25.0 261.02 MB

Generic C/C++ client for Nakama server.

Home Page: https://heroiclabs.com/docs/cpp-client-guide

License: Apache License 2.0

CMake 2.59% C++ 96.67% C 0.52% Dockerfile 0.08% Shell 0.02% Java 0.12%
cpp-client nakama-server multiplayer social

nakama-cpp's Introduction

Nakama C/C++ Client SDK

C/C++ client for Nakama server.

Nakama is an open-source server designed to power modern games and apps. Features include user accounts, chat, social, matchmaker, realtime multiplayer, and much more.

This client implements the full API and socket options with the server. It's written in C and C++11 with minimal dependencies to support Unreal, Cocos2d-x, Oculus, and other custom engines and frameworks.

We also support various game consoles. Please reach out to [email protected] to discuss console support for your project.

If you experience any issues with the client, open an issue.

Full documentation is online - https://heroiclabs.com/docs

Usage

Client

The client object has many methods to execute various features in the server or open realtime socket connections with the server.

Use the connection credentials to build a client object.

NClientParameters parameters;
parameters.serverKey = "defaultkey";
parameters.host = "127.0.0.1";
parameters.port = DEFAULT_PORT;
NClientPtr client = createDefaultClient(parameters);

The createDefaultClient will create HTTP/1.1 client to use REST API.

Tick

The tick method pumps requests queue and executes callbacks in your thread. You must call it periodically (recommended every 50ms) in your thread.

client->tick();
if (rtClient)
    rtClient->tick();

Without this the default client and realtime client will not work, and you will not receive responses from the server.

Authenticate

There's a variety of ways to authenticate with the server. Authentication can create a user if they don't already exist with those credentials. It's also easy to authenticate with a social profile from Google Play Games, Facebook, Game Center, etc.

string email = "[email protected]";
string password = "batsignal";

auto successCallback = [](NSessionPtr session)
{
    std::cout << "session token: " << session->getAuthToken() << std::endl;
};

auto errorCallback = [](const NError& error)
{
};

client->authenticateEmail(email, password, "", false, {}, successCallback, errorCallback);

Sessions

When authenticated the server responds with an auth token (JWT) which contains useful properties and gets deserialized into a NSession object.

std::cout << session->getAuthToken() << std::endl; // raw JWT token
std::cout << session->getUserId() << std::endl;
std::cout << session->getUsername() << std::endl;
std::cout << "Session has expired: " << session->isExpired() << std::endl;
std::cout << "Session expires at: " << session->getExpireTime() << std::endl;

It is recommended to store the auth token from the session and check at startup if it has expired. If the token has expired you must reauthenticate. The expiry time of the token can be changed as a setting in the server.

string authtoken = "restored from somewhere";
NSessionPtr session = restoreSession(authtoken);
if (session->isExpired()) {
    std::cout << "Session has expired. Must reauthenticate!" << std::endl;
}

Requests

The client includes lots of builtin APIs for various features of the game server. These can be accessed with the async methods. It can also call custom logic as RPC functions on the server. These can also be executed with a socket object.

All requests are sent with a session object which authorizes the client.

auto successCallback = [](const NAccount& account)
{
    std::cout << "user id : " << account.user.id << std::endl;
    std::cout << "username: " << account.user.username << std::endl;
    std::cout << "wallet  : " << account.wallet << std::endl;
};

client->getAccount(session, successCallback, errorCallback);

Realtime client

The client can create one or more realtime clients with the server. Each realtime client can have it's own events listener registered for responses received from the server.

bool createStatus = true; // if the socket should show the user as online to others.
// define realtime client in your class as NRtClientPtr rtClient;
rtClient = client->createRtClient();
// define listener in your class as NRtDefaultClientListener listener;
listener.setConnectCallback([]()
{
    std::cout << "Socket connected" << std::endl;
});
rtClient->setListener(&listener);
rtClient->connect(session, createStatus);

Don't forget to call tick method. See Tick section for details.

Logging

Initializing Logger

Client logging is off by default.

To enable logs output to console with debug logging level:

NLogger::initWithConsoleSink(NLogLevel::Debug);

To enable logs output to custom sink with debug logging level:

NLogger::init(sink, NLogLevel::Debug);

Using Logger

To log string with debug logging level:

NLOG_DEBUG("debug log");

formatted log:

NLOG(NLogLevel::Info, "This is string: %s", "yup I'm string");
NLOG(NLogLevel::Info, "This is int: %d", 5);

Changing logging level boundary:

NLogger::setLevel(NLogLevel::Debug);

NLogger behaviour depending on logging level boundary:

  • Debug writes all logs.

  • Info writes logs with Info, Warn, Error and Fatal logging level.

  • Warn writes logs with Warn, Error and Fatal logging level.

  • Error writes logs with Error and Fatal logging level.

  • Fatal writes only logs with Fatal logging level.

Note: to use logging macros you have to define NLOGS_ENABLED.

Websockets transport

Nakama C++ client has built-in support for WebSocket. This is available on all supported platforms.

Client will default to use the Websocket transport provided by C++ REST SDK.

You can use a custom Websocket transport by implementing the NRtTransportInterface:

rtClient = client->createRtClient(websockets_transport);

Activity timeout

Built-in websocket transport supports "Activity timeout" feature - if no any message received from server during "Activity timeout" then connection will be closed. Set 0 to disable this feature (default value).

rtClient->getTransport()->setActivityTimeout(20000); // 20 sec

You can change ping period on server - ping_period_ms parameter:

https://heroiclabs.com/docs/install-configuration/#socket

Android

To use our native C++ library in your Android application, you will need to include an additional .aar file that we ship for SSL support.

For example, in Gradle:

implementation files("<path/to/libnakama-sdk.aar>")

Then you will need to load our native library from Java by calling System.loadLibrary("nakama-sdk") when your activity is created.

How to build

Prerequisite

You should download vcpkg (https://github.com/microsoft/vcpkg) somewhere on your machine set your $VCPKG_ROOT environment variable to point to the repository.

Windows

Linux

  • CMake
  • Ninja
  • gcc-c++/clang++

Ubuntu 18.04

Fresh Ubuntu 18.04 setup:

sudo apt update
sudo apt install git pkg-config g++ curl zip unzip tar make
mkdir -p ~/opt; curl -L https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz  | tar -C ~/opt -xzf -
mkdir -p ~/bin; ln -s ~/opt/cmake-3.23.1-linux-x86_64/bin/cmake ~/bin/
cd /tmp; curl -L -O https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip; unzip ninja-linux.zip; mv ninja ~/bin
exec /bin/bash -l   # make ~/bin available on PATH
git clone /mnt/z/repos/nakama-cpp ~/localrepos/nakama-cpp
cd ~/localrepos/nakama-cpp
${VCPKG_ROOT}/bootstrap-vcpkg.sh

If you plan to use WITH_LIBCXX, then also do following:

sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
sudo apt install g++-11 python3-distutils
export CC=/usr/bin/gcc-11
export CXX=/usr/bin/g++-11

OS X

  • brew install ninja cmake pkg-config
  • XCode or XCode command line tools

Build

There are preconfigured presets in the CMakePresets.json. You can get list of presets for your system with:

cmake --list-presets

Then configure the build system.

cmake --preset linux-amd64

The configuration step builds all necessary dependencies and installs them under ./build/*/vcpkg_installed.

Next, build the SDK:

cmake --build build/linux-amd64 --config MinSizeRel --target install

Linux

To build Linux release you can use provided Docker image like following:

docker buildx build -f scripts/Dockerfile --progress=plain --output=./out .

Android

To build for Android set your ANDROID_NDK_HOME environment variable to your NDK before building.

Your NDK is typically located within your SDK:<sdk>/ndk/<ndk-version>

Our prebuilt libraries target Android NDK 25.1.8937393.

Windows 32-Bit

We support native 32-bit builds. Keep in mind that when building from source, you must run your command in a 32-bit (e.g., C:\Windows\System32\cmd.exe) environment.

Build modifiers

Presets mostly represent platforms SDK can be built for. Sometimes within platforms build configuration need to be modified, but if we create preset for each build configuration we'd have too many of them. We have a way to alter build behaviour of any preset with a build modifiers mechanism.

Supported build modifiers are:

  • LIBHTTPCLIENT_FORCE_WEBSOCKETPP: On Windows platforms libhttpclient always includes websocketpp transport and uses it if Windows doesn't support websocket natively (< Windows 8). You can set this build modifier to force use of websocketpp transport, so that it can be tested without installing Windows 7. If you
  • WITH_LIBCXX: dynamically link with libc++ instead of libstdc++ on Linux platform.
    • LIBCXX_STATIC: link libc++ statically
  • ADDRESS_SANITIZER: instrument library with AddressSanitizer

Build modifiers are CMake variables passed at configure time using -D switch. Example use:

cmake --preset linux-amd64 -DWITH_LIBCXX=ON

Release

cmake --install --preset linux-amd64 --config MinSizeRel

You should see dynamic library and headers in the ./out directory. This is your release.

It is safe to combine (overlay) multiple platforms releases in the same directory structure, because binary artifacts paths won't clash and include files are identical on all platforms.

MacOSX Universal binary

Currently, our dependency manager can't build non-CMake based projects as universal binary. Watch this PR for a proper fix. Until then building universal binaries requires building shared libs for arm64 and x86_64 architectures and gluing them together with lipo tool.

To build universal binary first compile individual shared lib for arm64 and x86_64. Following commands are for M1, adjust preset names if you are on Intel CPU:

cmake --preset macosx-x64-host_arm64
cmake --build build/macosx-x64-host_arm64 --config MinSizeRel --target install

cmake --preset macosx-arm64-host_arm64
cmake --build build/macosx-arm64-host_arm64 --config MinSizeRel --target install
cp -r out/macosx-x64 out/macosx-universal
lipo -create -output out/macosx-universal/nakama-sdk.framework/Versions/A/nakama-sdk out/macosx-{arm64,x64}/nakama-sdk.framework/nakama-sdk

You can then archive and release out/osx-universal directory.

Transports

Platforms vary in their implementation of transports for HTTP and WS. One of the transports, libhttpclient itself can use different implementations depending on the platform.

HTTP:

Platform Transport
Windows libhttpclient -> winhttp
Android libcurl
Linux libhttpclient->curl
MacOS libhttpclient -> OS
iOS libhttpclient -> OS
Windows 7 libhttpclient -> websocketpp

Websockets:

Platform Transport
Windows libhttpclient -> winhttp
Android wslay
Linux wslay
MacOS wslay
iOS wslay
Windows 7 libhttpclient -> websocketpp

How to integrate the SDK

There are three ways of integrating the SDK into your build.

Github Release

We provide headers and binaries for all supported platforms in our releases section.

CMake

After downloading it to a folder you've configured CMake to look for targets in, you can import our package via the find_package command in CMake: find_package(nakama-sdk).

vcpkg

Our SDK integrates with vcpkg by providing itself and a few dependencies through a git registry. To include it in your vcpkg manifest, create a vcpkg-configuration.json in your root directory.

{
    "registries":
    [
        {
            "kind": "git",
            "repository": "https://github.com/heroiclabs/nakama-vcpkg-registry",
            "baseline": "<commit>",
            "reference": "<branch>",
            "packages": ["nakama-sdk", "wslay"]
        }
    ]
}

Then you can add it as you would any other vcpkg port in your vcpkg.json:

    "dependencies": [
      {
        "name": "nakama-sdk"
        "features": [<desired-feature-1>, <desired-feature-2>]
      }]

vcpkg does not currently allow us to provide default features per platform, so you must specify your desired transports/features in your own vcpkg.json.

For an example, look at how our cocos-2d-x client does this. Also see our our built-in transports for each platform that we represent with vcpkg features. If you do not specify a transport for the platform, the client will expect you to pass in your own at runtime.

nakama-cpp's People

Contributors

comerford avatar daggersoath avatar dhruvkakadiya avatar dimon4eg avatar docsncode avatar gameinstitute avatar lugehorsam avatar marot avatar mofirouz avatar pospelove avatar redbaron avatar rpvela avatar tomglenn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nakama-cpp's Issues

Add more client and realtime tests

  • Add tests for matchmaking.
  • Add tests for server-authoritative multiplayer.
    • You'll need to use the existing Lua modules to send a RPC request to create matches.
  • Add test for creating and submitting tournaments.
    • You'll need to use this Lua module to create tournaments.

XCODE gives "Linker Command Failed with Exit Code 1" on 2.5.1 and 2.4.0

This may be something I'm doing wrong, but I've followed the instructions in the readme to the best of my knowledge and I am unable to make it work.

I am aware there was an issue with 2.5.0, but I cannot build with 2.5.1 or 2.4.0 either.

The instructions say:

  1. Add NAKAMA_CPP_SDK/include in Build Settings > Header Search Paths
  2. Add libs folder in Build Settings > Library Search Paths:
    NAKAMA_CPP_SDK/libs/mac - for Mac

image

  1. In General > Frameworks, Libraries, and Embedded Content add following:
    all .a files located in libs folder
    foundation and security frameworks

image

I get "Linker Command Failed with Exit Code 1"
image

Thank you in advance for any assistance.

Here is my program, in case that helps:
image

Linux build fails

Hi there!
I have a following backtrace with SIGSEGV on creating defaultClient(release 2.10 build)

std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) 0x00007fa5303b719f Nakama::RestClient::RestClient(Nakama::NClientParameters const&, std::shared_ptr<Nakama::NHttpTransportInterface>) 0x00007fa5327116d7 Nakama::createRestClient(Nakama::NClientParameters const&, std::shared_ptr<Nakama::NHttpTransportInterface>) 0x00007fa5326dc079 NCocosHelper::createDefaultClient NCocosHelper.cpp:32 HelloWorld::InitNetwork HelloWorldScene.cpp:141 HelloWorld::init HelloWorldScene.cpp:49 HelloWorld::create HelloWorldScene.h:41 HelloWorld::createScene HelloWorldScene.cpp:34 AppDelegate::applicationDidFinishLaunching AppDelegate.cpp:121 cocos2d::Application::run CCApplication-linux.cpp:70 main main.cpp:38 __libc_start_main 0x00007fa52f95cb97 _start 0x0000556e2dc5640a

I haven't built yet nakama-cpp with debug symbols. Maybe you have any ideas before I have to check it

C++ CLient SSL verification problem

Greeting Developers:

When I use the nakama-cpp-2.5.1 to set a client with SSL, I encountered the problem :
"[Nakama::RestClient::reqError] NError: ConnectionError
message: [NHttpClientCppRest::request] exception: Error in SSL handshake
start error , error message:message: [NHttpClientCppRest::request] exception: Error in SSL handshake"

I just set the parameter.ssl to true. And the nakama server opened the ssl feature also.

And I have checked the source code of the nakama-cpp-2.5.1, I didn't find any place where could import the certificate.

I was wondering if there is any way to implement ssl communication to the server using nakama-cpp-2.5.1.

Thanks!!

Nakama cpp not compile xCode 12

Hi,
When I try to compile Nakama C++ SDK in xCode 12 using a Simulator (example: iPhone X), it doesn't work.
Using a real device it works perfectly. The problem is in simulators with different architectures.

Anyone can help me?

Error:

ld: in /nakama_cocos2d_sdk/libs/ios/libnakama-cpp.a(BaseClient.cpp.o), building for iOS Simulator, but linking in object file built for iOS, file โ€˜/nakama_cocos2d_sdk/libs/ios/libnakama-cpp.aโ€™ for architecture arm64

Call RPC without a session

Hello,

I would like to have the ability to call RPC from client without the need to authenticate first.

Apple - Allow headers to be found solely via framework linkage

We think that due to a bug in CMake's PUBLIC HEADER property, users need to include headers via manually adjusting their header paths even though they've already specified that they need to link to the framework.

A modulemap file may be related.

Support Android NDK r14b, for Unreal Engine

Currently as of the latest version, Unreal Engine 4.21 uses Android NDK r14b for Android, it is an old NDK which is not support with Nakama.

I know we've talked about this, just wanted to know if there's any updates on release time.

Failing to build example for Mac

Trying nakama-cpp client SDK for Mac and it's failing to build.

Undefined symbols for architecture x86_64:
  "_CFErrorCopyDescription", referenced from:
      (anonymous namespace)::getSSLErrorDescription(int) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_CFErrorCreate", referenced from:
      (anonymous namespace)::getSSLErrorDescription(int) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_CFRelease", referenced from:
      ix::SocketAppleSSL::close() in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
      (anonymous namespace)::getSSLErrorDescription(int) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_CFStringGetCString", referenced from:
      (anonymous namespace)::getSSLErrorDescription(int) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_CFStringGetSystemEncoding", referenced from:
      (anonymous namespace)::getSSLErrorDescription(int) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLClose", referenced from:
      ix::SocketAppleSSL::close() in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLCreateContext", referenced from:
      ix::SocketAppleSSL::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::function<bool ()> const&) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLHandshake", referenced from:
      ix::SocketAppleSSL::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::function<bool ()> const&) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLRead", referenced from:
      ix::SocketAppleSSL::recv(void*, unsigned long) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLSetConnection", referenced from:
      ix::SocketAppleSSL::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::function<bool ()> const&) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLSetIOFuncs", referenced from:
      ix::SocketAppleSSL::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::function<bool ()> const&) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLSetPeerDomainName", referenced from:
      ix::SocketAppleSSL::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::function<bool ()> const&) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLSetProtocolVersionMin", referenced from:
      ix::SocketAppleSSL::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::function<bool ()> const&) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_SSLWrite", referenced from:
      ix::SocketAppleSSL::send(char*, unsigned long) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_kCFAllocatorDefault", referenced from:
      ix::SocketAppleSSL::connect(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >&, std::__1::function<bool ()> const&) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
      (anonymous namespace)::getSSLErrorDescription(int) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
  "_kCFErrorDomainOSStatus", referenced from:
      (anonymous namespace)::getSSLErrorDescription(int) in libixwebsocket.a(IXSocketAppleSSL.cpp.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.

Client and Realtime Client different host/ssl config

Hi,
Currently, if we need to use a different host and/or SSL value for the client and the realtime client, the only way is to create a client as usual, and then a second one to be able to call the createRtClient(...) method, as this:

DefaultClientParameters parameters;

parameters.serverKey = nk_serverKey;
parameters.host      = nk_host;
parameters.port      = nk_port;
parameters.ssl       = nk_ssl;

_client = createDefaultClient(parameters);

... 
DefaultClientParameters parameters;
parameters.host = nk_rt_host;
parameters.ssl  = nk_rt_ssl;

NClientPtr clientForRt = createDefaultClient(parameters);
_rtClient = clientForRt->createRtClient(nk_rt_port, transport);
// we should have done _client->createRtClient(nk_rt_port, transport) if it was on the same host/same ssl config for both;

Maybe there should be a way to create the realtime client with the parameters we want :)

Malformed `Content-Type` header breaks with Nakama 2.7.x +

I'm experiencing an issue with the nakama-cpp lib talking to nakama in a docker container. It is sending a Content-Type: text/plain; charset=utf-8, application/json header (which is not valid AFAIK). I get back an golang mime type error.

I suspect this has always been an issue but only errors with 2.7 / golang 1.3.x (have not confirmed this). One annoyance is that the error never hit the nakama logs so for a while I was suspecting docker networking barfing on it before forwarding to the container. It was only after I realized that gRPC code 3 was being returned that I knew it was reaching Nakama but not error logging.

With nakama 2.5.1 container (does not error)

$ curl -X POST "http://127.0.0.1:7350/v2/account/authenticate/custom?create=true&username=" -H "Content-Type: text/plain; charset=utf-8, application/json" -H "Authorization: Basic <redacted>" -H "Accept: application/json" -d "{\"id\":\"<redacted>\"}"; echo
{"created":true,"token":"<redacted>"}

With nakama 2.7.0 container (does error)

$ curl -X POST "http://127.0.0.1:7350/v2/account/authenticate/custom?create=true&username=" -H "Content-Type: text/plain; charset=utf-8, application/json" -H "Authorization: Basic <redacted>" -H "Accept: application/json" -d "{\"id\":\"<redacted>\"}"; echo
{"error":"mime: invalid media parameter","code":3,"message":"mime: invalid media parameter"}

I suspect the issue is with cpprestsdk you use not being very smart/careful about which headers are actually allowed to have multiple of (as a comma separated list of values: https://github.com/heroiclabs/nakama-cpp/blob/master/third_party/cpprestsdk/Release/include/cpprest/http_headers.h#L172-L191 )
Since request.set_body() is called with no second content-type property https://github.com/heroiclabs/nakama-cpp/blob/v2.1.0/src/NHttpClientCppRest.cpp#L89-L95 the default of text/plain; charset=utf-8 is being used: https://github.com/heroiclabs/nakama-cpp/blob/master/third_party/cpprestsdk/Release/include/cpprest/http_msg.h#L677-L704 However, you are then adding more headers, including a Content-Type: application/json one https://github.com/heroiclabs/nakama-cpp/blob/v2.1.0/src/NHttpClientCppRest.cpp#L94 that was set earlier: https://github.com/heroiclabs/nakama-cpp/blob/v2.1.0/src/RestClient.cpp#L159

[NRtClient::onTransportMessage] NRtError: BAD_INPUT

##Description

Error thrown by CPP client

##Steps to Reproduce

Create a Nakama CPP client on xcode

then add to matchmaker

void joinMatcher(const int32_t& minCount,const int32_t& maxCount,const string& query,
NStringMap stringProperties,NStringDoubleMap numericProperties){

auto successCallback = [](const NMatchmakerTicket& ticket)
 {
   std::cout << "Matchmaker ticket: " << ticket.ticket << std::endl;
 };

 //int32_t minCount = 2;
// int32_t maxCount = 4;
 //string query = "*";
 //NStringMap stringProperties;
// NStringDoubleMap numericProperties;
 //stringProperties.emplace("region", "africa");
 //numericProperties.emplace("rank", 8.0);
std::cout << "minCount: " << minCount << std::endl;

 _rtClient->addMatchmaker(
     minCount,
     maxCount,
     query,
     stringProperties,
     numericProperties,
     successCallback);

_listener.setMatchmakerMatchedCallback([](NMatchmakerMatchedPtr matched)
{
  std::cout << "Matched! matchId: " << matched->matchId << std::endl;
});

}

Expected Result

[NRtClient::onTransportMessage] NRtError: BAD_INPUT

Actual Result

[NRtClient::updateStatus] ...
[NWebsocketCppRest::send] sending 31 bytes binary ...
minCount: 2
[NRtClient::addMatchmaker] ...
[NWebsocketCppRest::send] sending 6 bytes binary ...
[NWebsocketCppRest::operator()] socket message received 95 bytes
[NWebsocketCppRest::operator()] socket message received 3 bytes
Status updated
[NWebsocketCppRest::operator()] socket message received 211 bytes
[NWebsocketCppRest::operator()] socket message received 44 bytes
[NRtClient::onTransportMessage] NRtError: BAD_INPUT
Invalid minimum count, must be >= 2
[NWebsocketCppRest::operator()] ping

Context

Unity
Unreal
Other
Your Environment

Nakama: X.X.X
Database: X.X.X
Environment name and version:
Operating System and version:
Nakama 2.7.0
I am using :
Mac OS Catalina
Model Name: MacBook Pro
Model Identifier: MacBookPro15,1
Processor Name: 6-Core Intel Core i7
Processor Speed: 2.6 GHz
Number of Processors: 1
Total Number of Cores: 6
L2 Cache (per Core): 256 KB
L3 Cache: 9 MB
Hyper-Threading Technology: Enabled
Memory: 16 GB
Boot ROM Version: 1037.40.124.0.0 (iBridge: 17.16.11081.0.0,0)
Serial Number (system): C02XHCN8JG5J
Hardware UUID: B43B190C-C4C5-58B3-9BE4-0CF3FB691206
Activation Lock Status: Enabled

Build build_windows.py is failed

I need to build client to .dll.
I do not build build_windows.py.
src.obj : error LNK2019: ๆ— ๆณ•่งฃๆž็š„ๅค–้ƒจ็ฌฆๅท __imp_pthread_create๏ผŒๅ‡ฝๆ•ฐ main ไธญๅผ•็”จไบ†่ฏฅ็ฌฆๅท [C:\Users\Administrator\Desktop\nakamaCppClient\nakama\CMakeFiles\CMakeTmp\cmTC_70533.vcxproj]

src.obj : error LNK2019: ๆ— ๆณ•่งฃๆž็š„ๅค–้ƒจ็ฌฆๅท __imp_pthread_detach๏ผŒๅ‡ฝๆ•ฐ main ไธญๅผ•็”จไบ†่ฏฅ็ฌฆๅท [C:\Users\Administrator\Desktop\nakamaCppClient\nakama\CMakeFiles\CMakeTmp\cmTC_70533.vcxproj]

src.obj : error LNK2019: ๆ— ๆณ•่งฃๆž็š„ๅค–้ƒจ็ฌฆๅท __imp_pthread_exit๏ผŒๅ‡ฝๆ•ฐ main ไธญๅผ•็”จไบ†่ฏฅ็ฌฆๅท [C:\Users\Administrator\Desktop\nakamaCppClient\nakama\CMakeFiles\CMakeTmp\cmTC_70533.vcxproj]

src.obj : error LNK2019: ๆ— ๆณ•่งฃๆž็š„ๅค–้ƒจ็ฌฆๅท __imp_pthread_join๏ผŒๅ‡ฝๆ•ฐ main ไธญๅผ•็”จไบ†่ฏฅ็ฌฆๅท [C:\Users\Administrator\Desktop\nakamaCppClient\nakama\CMakeFiles\CMakeTmp\cmTC_70533.vcxproj]

src.obj : error LNK2019: ๆ— ๆณ•่งฃๆž็š„ๅค–้ƒจ็ฌฆๅท pthread_atfork๏ผŒๅ‡ฝๆ•ฐ main ไธญๅผ•็”จไบ†่ฏฅ็ฌฆๅท [C:\Users\Administrator\Desktop\nakamaCppClient\nakama\CMakeFiles\CMakeTmp\cmTC_70533.vcxproj]

C:\Users\Administrator\Desktop\nakamaCppClient\nakama\CMakeFiles\CMakeTmp\Debug\cmTC_70533.exe : fatal error LNK1120: 5 ไธชๆ— ๆณ•่งฃๆž็š„ๅค–้ƒจๅ‘ฝไปค [C:\Users\Administrator\Desktop\nakamaCppClient\nakama\CMakeFiles\CMakeTmp\cmTC_70533.vcxproj]

C++ - Return a future from functions

Using the functions that run on another thread e.g. client->authenticateDevice() don't return any way to control their execution, please can you return a future from these functions so i can await them?

Here's an example of a workaround i'm using at the moment:


//
// MIT LICENSE
//
// Copyright (c) 2020 R.G.Bamford
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//

#pragma once

#include <nakama-cpp/Nakama.h>

#include <thread>
#include <iostream>

using namespace std;
using namespace Nakama;

class TestServer {
public:
	bool Connect() {
		cout << "Testing the connection to the test server." << endl;

		NHttpTransportPtr transport = createDefaultHttpTransport();
		transport->setBaseUri("http://www.google.com");

		NHttpRequest request;
		request.path = "/";
		request.method = NHttpReqMethod::GET;

		bool waiting = true;
		int statusCode;
		transport->request(request,
			[&statusCode, &waiting](const NHttpResponsePtr& response) {
				statusCode = response->statusCode;
				waiting = false;
			});

		while (waiting) {
			this_thread::sleep_for(chrono::milliseconds(8));
			transport->tick();
		}

		cout << "Finished! Status code: " << statusCode << endl;

		return (statusCode == 200);
	}
};

Thanks!

Error cancelling matchmaking from the same session ID using Nakama CPP client

Description

Using nakama C wrapper in nakama's CPP client produces an error when trying to cancel matchmaking using the same session. Debugger output when running local nakama suggests that the matchmaking handler expects the Party ID or Session ID to be present, exclusively -- not both at the same time.

What's the expected flow here? Are we using wrong session to initiate/cancel the matchmaking?

Steps to Reproduce

Using C NakamaWrapper

RTClient->addMatchmakerParty(
		TCHAR_TO_UTF8(*PartyID), TCHAR_TO_UTF8(*matchQuery), minmatchedCount, maxMatchedCount, stringProperties, {}, SuccessCallback, ErrorCallback);
...
RTClient->removeMatchmakerParty(TCHAR_TO_UTF8(*TicketId), SuccessCallback, ErrorCallback);

This is the same client using the weak pointer to the NRtClientInterface

{"level":"debug","ts":"2022-01-11T17:08:45.001Z","caller":"server/pipeline.go:65","msg":"Received *rtapi.Envelope_PartyMatchmakerAdd message","uid":"cded365b-b40c-455a-bbfb-faf7f8aed966","sid":"1c95065c-7301-11ec-9dac-7106fdcb5b46","cid":"1","message":{"PartyMatchmakerAdd":{"party_id":"8212a156-5e77-4c1a-b93a-c6c10f6dd5c1.nakama1","min_count":2,"max_count":4,"query":"properties.serverVersion:057a3fe6336667f7f4ebe6d532eec1ed183cbbd0","string_properties":{"serverVersion":"057a3fe6336667f7f4ebe6d532eec1ed183cbbd0"}}}}
{"level":"debug","ts":"2022-01-11T17:08:45.002Z","caller":"server/session_ws.go:395","msg":"Sending *rtapi.Envelope_PartyMatchmakerTicket message","uid":"cded365b-b40c-455a-bbfb-faf7f8aed966","sid":"1c95065c-7301-11ec-9dac-7106fdcb5b46","envelope":"cid:\"1\" party_matchmaker_ticket:{party_id:\"8212a156-5e77-4c1a-b93a-c6c10f6dd5c1.nakama1\" ticket:\"61a33496-2503-4446-a619-8e8584814c13\"}"}
{"level":"debug","ts":"2022-01-11T17:09:05.987Z","caller":"server/pipeline.go:65","msg":"Received *rtapi.Envelope_MatchmakerRemove message","uid":"cded365b-b40c-455a-bbfb-faf7f8aed966","sid":"1c95065c-7301-11ec-9dac-7106fdcb5b46","cid":"2","message":{"MatchmakerRemove":{"ticket":"61a33496-2503-4446-a619-8e8584814c13"}}}
{"level":"debug","ts":"2022-01-11T17:09:05.987Z","caller":"server/session_ws.go:393","msg":"Sending error message","uid":"cded365b-b40c-455a-bbfb-faf7f8aed966","sid":"1c95065c-7301-11ec-9dac-7106fdcb5b46","payload":"CgEyWh8IAxIbTWF0Y2htYWtlciB0aWNrZXQgbm90IGZvdW5k"}

Debugger:
image

The function that errors is here
https://github.com/heroiclabs/nakama/blob/df2e6bfc1652671ebea2644cff165a22c312fb1d/server/matchmaker.go#L541

func (m *LocalMatchmaker) RemoveSession(sessionID, ticket string) error {
	m.Lock()

	index, ok := m.indexes[ticket]
	if !ok || index.PartyId != "" || index.SessionID != sessionID {
		// Ticket did not exist, or the caller was not the ticket owner - for example a user attempting to remove a party ticket.
		m.Unlock()
		return runtime.ErrMatchmakerTicketNotFound

Overriding the session ID makes the match cancel properly
rpvela/nakama@3ec6e0c

Expected Result

StopPartyMatchmaking::<lambda_3661080582e47bd6dee52ce2181826bf>::operator (): Cancelled matchmaking.

Actual Result

StopPartyMatchmaking::<lambda_7bc4c986aef746a6d3dcd754700333c0>::operator (): Error cancelling matchmaking 'Matchmaker ticket not found'

Context

  • Unity
  • Unreal
  • Other

Your Environment

  • Nakama: heroiclabs/nakama:latest and 3.0.0-dev from github clone
  • Database: CCL v20.2.18 @ 2021/11/08 15:28:13 (go1.13.14)
  • Environment name and version: nakama-cpp-wrapper, latest and cloned version from github
  • Operating System and version: Windows 10/11, Ubuntu 20.04

Compile with position independent code enabled

Hi,

First of all, thanks for making this library!
I've been writing a Godot GDNative wrapper for Nakama https://github.com/opcon/nakama-godot, which compiles into a shared library.

To do this, the nakama-cpp libraries need to be compiled with position independent code (-fPIC). I've made this change locally, and everything is working.

Is it possible to compile the released versions of nakama-cpp with -fPIC?

I don't know enough about C++ to know if this has performance/other implications.

Cheers :)

Feature: Add possibility to add parameters to RPC request

From within UE4 I call an rpc function like this:

		auto successFunc = [](const Nakama::NRpc& rpc)
		{
			UE_LOG_ONLINE_SESSION(Log, TEXT("Session Create Success"));
		};
		Nakama::ErrorCallback errorFunc = [](const Nakama::NError& error) 
		{
			UE_LOG_ONLINE_SESSION(Error, TEXT("Session Create Error: %s"), UTF8_TO_TCHAR(error.message.c_str()));
		};

		std::string foo = R"({"owning_user_id": "Test","owning_username":"TestName","session_name": "GameSession","session_state": 0})";
		client->rpc(sessionPtr, "sessions/create", foo, successFunc, errorFunc);

In some cases there might be the need to add url parameters or headers to an RPC request. However this is currently not possible.

For example a user might have an RPC that updates data of a player-party. Showing the intent by using PUT could make api intent clearer. Another example would be a server whose response to a procedure can be a different MIME type and the client passes the type via header.

Add build and release instructions.

  • We need more build instructions for Windows / Mac / Linux (both 32bit and 64bit).
  • We also need to bundle the release as GitHub releases as the file sizes are massive.

Build failing

I'm trying to build using a different C++ Standard.
After following the guide in your readme I'm getting this error:

BUILD_REST_CLIENT = True
BUILD_GRPC_CLIENT = False
BUILD_HTTP_CPPREST = True
BUILD_WEBSOCKET_CPPREST = True
BUILD_C_API = True
BUILD_NAKAMA_TESTS = False
copied nakama-cpp
copied nonstd
copied nakama-c
copied nakama-cpp-c-wrapper
Building for Arch: x64, Toolset: v142, Mode: Release, DLL: False
calling: ['cmake', '-B', 'G:\\nakama-cpp\\build\\windows\\build\\v142_x64', '-G', 'Visual Studio 16 2019', '-T', 'v142', '-DCMAKE_SYSTEM_VERSION=10.0', '-DCMAKE_BUILD_TYPE=Release', '-DNAKAMA_SHARED_LIBRARY=OFF', '-DBUILD_REST_CLIENT=ON', '-DBUILD_GRPC_CLIENT=OFF', '-DBUILD_HTTP_CPPREST=ON', '-DBUILD_WEBSOCKET_CPPREST=ON', '-DBUILD_C_API=ON', '-A', 'x64', '../..']
-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.
-- The C compiler identification is MSVC 19.29.30141.0
-- The CXX compiler identification is MSVC 19.29.30141.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM_NASM compiler identification is NASM
-- Found assembler: C:/Users/Daniele/AppData/Local/bin/NASM/nasm.exe
CMake Warning (dev) at third_party/grpc/third_party/protobuf/cmake/CMakeLists.txt:43 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'protobuf_BUILD_TESTS'.
This warning is for project developers.  Use -Wno-dev to suppress it.

--
-- 3.14.0.0
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY) (found version "1.2.11")
-- Setting msvc options
-- websocketpp not found, using the embedded version
CMake Error at C:/Program Files/CMake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: system date_time regex) (found version
  "1.69.0")
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.23/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.23/Modules/FindBoost.cmake:2375 (find_package_handle_standard_args)
  third_party/cpprestsdk/Release/cmake/cpprest_find_boost.cmake:59 (find_package)
  third_party/cpprestsdk/Release/cmake/cpprest_find_websocketpp.cmake:17 (cpprest_find_boost)
  third_party/cpprestsdk/Release/src/CMakeLists.txt:68 (cpprest_find_websocketpp)


-- Configuring incomplete, errors occurred!
See also "G:/nakama-cpp/build/windows/build/v142_x64/CMakeFiles/CMakeOutput.log".
See also "G:/nakama-cpp/build/windows/build/v142_x64/CMakeFiles/CMakeError.log".

I've also installed NASM from the official site (this step is not mentioned in the readme) and set the environment variables for boost like this
image

Can someone help me please?

Callback from authentication request results in undefined behavior if Nakama client has been destroyed:

After a call to authenticateDevice(), if the endpoint being connected to is slow (in my case, firewalled due to a security group configuration "bug"), and the NClient object is disconnect()ed and destroyed, I am still seeing what looks like a callback from within nakama-cpp.dll (I'm using the Unreal client, but have looked through the code enough to suspect the bug is here) will still fire. I cannot figure out how to cancel this outstanding auth request in a clean way, and I do not see code in this repo that does so either.

Thanks in advance for your time.

Add Sign In With Apple method

In nakama-cpp library, these are the methods that we can use in order to authenticate a player to Nakama Server:

virtual void authenticateDevice(.....)
virtual void authenticateEmail(.....)
virtual void authenticateFacebook(.....)
virtual void authenticateGoogle(.....)
virtual void authenticateGameCenter(.....)
virtual void authenticateCustom(.....)
virtual void authenticateSteam(.....)

These methods works perfect, but we CAN'T authenticate through Apple.
If we use a third-party login service, Apple is forcing developers to implement Sign in with Apple (GameCenter is not enough).

Nakama Server is already supporting it: https://github.com/heroiclabs/nakama/releases/v2.13.0
But we need to add this feature to nakama-cpp library.

Topic related: https://forum.heroiclabs.com/t/sign-in-with-apple/1057

Thanks

Crash in ppltasks Library

Background:
Compiled the Nakama c++ client library, including CppRestSDK, gRPC, SSL, RapidJson, and zlib, for use in ARM64 on the Hololens 2. Using C++/WinRT but not using the /ZW switch so it's still conformal C++17. Everything compiles correctly and the program runs properly on the Hololens when deployed. (This isn't the emulator version, it's the actual ARM64 hardware.)

I copy/pasted the default example class from nakama-cmake-client-example.cpp into our code, as a way to bootstrap the development. Dropped the class into our App class, and the default initializer starts as expected. Inside _client->authenticateDevice, the software hits an exception inside ppltasks at line 1910 when the "_LockHolder" mutex goes out of scope and UNLOCKS the mutex. It does sucessfully lock it. Also, from what I can tell, this is also NOT the first time through this code in the program, because when I put a breakpoint on it, it doesn't crash the first time through.

The callstack looks as such:

.exe!std::_Mutex_base::unlock() Line 67
.exe!std::lock_guard<std::mutex>::~lock_guard<std::mutex>() Line 444
.exe!Concurrency::details::_Task_impl_base::_ScheduleContinuation(Concurrency::details::_ContinuationTaskHandleBase * _PTaskHandle) Line 1915
.exe!Concurrency::task<web::http::http_response>::_ThenImpl<web::http::http_response,std::function<void __cdecl(Concurrency::task<web::http::http_response>)>>(const std::function<void __cdecl(Concurrency::task<web::http::http_response>)> & _Func, Concurrency::details::_ThenImplOptions & _Options) Line 3927
.exe!Concurrency::task<web::http::http_response>::then<void <lambda>(Concurrency::task<web::http::http_response>)>(const Nakama::NHttpClientCppRest::request::__l2::void <lambda>(Concurrency::task<web::http::http_response>) & _Func) Line 3188
.exe!Nakama::NHttpClientCppRest::request(const Nakama::NHttpRequest & req, const std::function<void __cdecl(std::shared_ptr<Nakama::NHttpResponse>)> & callback) Line 151
.exe!Nakama::RestClient::sendReq(Nakama::RestReqContext * ctx, Nakama::NHttpReqMethod method, std::string && path, std::string && body, std::multimap<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string const ,std::string>>> && args) Line 160
.exe!Nakama::RestClient::authenticateDevice(const std::string & id, const std::optional<std::string> & username, const std::optional<bool> & create, const std::map<std::string,std::string,std::less<std::string>,std::allocator<std::pair<std::string const ,std::string>>> & vars, std::function<void __cdecl(std::shared_ptr<Nakama::NSessionInterface>)> successCallback, std::function<void __cdecl(Nakama::NError const &)> errorCallback) Line 340
.exe!NakamaSessionManager::start(const std::string & deviceId) Line 116
.exe!winrt::App::Scene::{ctor}::__l2::<lambda>() Line 380

Let me know if you need more information, I would love to resolve this.

Side note: When I run it using the gRPC client, I get no crash but it's not seeing my Nakama server, so that's why I'm using createDefaultClient instead of createGRPCClient.

listFriends failing on 2.3.0 against 2.13.0 server.

Error:

[2020.10.27-21.24.11:348][337]LogOnlineFriend: Error: OSS: FOnlineFriendsNakama::ReadFriendsList failed Parse JSON failed. HTTP body: {"friends":[{"user":{"id":"c68b196b-af9d-407f-ba25-4210b47eecc4","username":"player_126eed7bf1","display_name":"player_126eed7bf1","lang_tag":"en","metadata":"{}","create_time":"2020-10-27T20:52:16Z","update_time":"2020-10-27T21:23:39Z"},"state":1,"update_time":"2020-10-27T21:23:39Z"}]} error: INVALID_ARGUMENT:friends[0]: Cannot find field.

Nakama::opt::optional performs unexpected conversions when compiling with different C++ language standards

With further investigation, I can confirm it is due to misaligned language standards. By changing my project from C++latest to C++14 Nakama::opt::make_optional aligns with the nonstd::optional_lite::optional class.

This is unfortunate that the nakama-cpp headers changes types depending on the language version. I think a potential fix would be to provide the two optional class interfaces in parallel (introducing a std::optional when available) or to just commit to a more hardened Nakama::NOptional type that could potentially allow conversions with nonstd::optional_lite::optional or std::optional.

Originally posted by @Daspien27 in #24 (comment)

Support SSL / WSS.

We need to support SSL for both gRPC as well as Websocket connections (WSS). This should be added as an option similar to the Trace option.

Headers missing from v1.60 release?

Greetings,

I downloaded v2.6.0 release for win-x64 and was looking forward to adding it to my Cmake project.

'find_package(nakama-sdk)' worked happily enough, but I wasn't able to find header files anywhere in the release folder.

The readme says "We provide headers and binaries for all supported platforms in our releases section." but I am not finding the headers anywhere. Please let me know if I'm missing something. Thank you!

UE4.24 compile error

For external libraries use the full path in PublicAdditionalLibraries, if its a system library then use PublicSystemLibraries/PublicSystemLibraryPaths

fix:
Replace PublicLibraryPaths with PublicAdditionalLibraries in build.cs
thanks.

macos 10.15.2 build source code err

git checkout v2.3.0 and run build_mac_all.py.

FAILED: third_party/cpprestsdk/Release/src/CMakeFiles/cpprest.dir/websockets/client/ws_client_wspp.cpp.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DBOOST_ALL_NO_LIB -DCPPREST_EXCLUDE_COMPRESSION=1 -DCPPREST_FORCE_HTTP_CLIENT_ASIO -DCPPREST_FORCE_HTTP_LISTENER_ASIO -DCPPREST_NO_SSL_LEAK_SUPPRESS -I../../../../third_party/cpprestsdk/Release/include -I../../../../third_party/cpprestsdk/Release/src/pch -I../../../../third_party/cpprestsdk/Release/libs/websocketpp -I../../../../third_party/grpc/third_party/boringssl/include -isystem /usr/local/include -stdlib=libc++ -Wno-return-type-c-linkage -Wno-unneeded-internal-declaration -std=c++11 -fno-strict-aliasing -O3 -DNDEBUG -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.10 -fvisibility=hidden -fPIC -pedantic -Wall -Wextra -Wcast-qual -Wconversion -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-format-attribute -Wmissing-include-dirs -Wpacked -Wredundant-decls -Wno-overloaded-virtual -Wno-sign-conversion -Wno-deprecated -Wno-unknown-pragmas -Wno-reorder -Wno-char-subscripts -Wno-switch -Wno-unused-parameter -Wno-unused-variable -Wno-unused-value -Wno-unknown-warning-option -Wno-return-type-c-linkage -Wno-unused-function -Wno-sign-compare -Wno-shorten-64-to-32 -Wno-unused-local-typedefs -MD -MT third_party/cpprestsdk/Release/src/CMakeFiles/cpprest.dir/websockets/client/ws_client_wspp.cpp.o -MF third_party/cpprestsdk/Release/src/CMakeFiles/cpprest.dir/websockets/client/ws_client_wspp.cpp.o.d -o third_party/cpprestsdk/Release/src/CMakeFiles/cpprest.dir/websockets/client/ws_client_wspp.cpp.o -c ../../../../third_party/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp In file included from ../../../../third_party/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:14: In file included from ../../../../third_party/cpprestsdk/Release/src/pch/stdafx.h:103: In file included from ../../../../third_party/cpprestsdk/Release/include/cpprest/http_client.h:68: In file included from /usr/local/include/boost/asio/ssl.hpp:22: In file included from /usr/local/include/boost/asio/ssl/stream.hpp:29: In file included from /usr/local/include/boost/asio/ssl/detail/io.hpp:21: In file included from /usr/local/include/boost/asio/ssl/detail/stream_core.hpp:21: In file included from /usr/local/include/boost/asio/deadline_timer.hpp:24: In file included from /usr/local/include/boost/asio/basic_deadline_timer.hpp:31: In file included from /usr/local/include/boost/asio/executor.hpp:338: /usr/local/include/boost/asio/impl/executor.hpp:179:22: error: no member named 'context' in 'std::__1::reference_wrapper<boost::asio::io_context>' return executor_.context(); ~~~~~~~~~ ^ /usr/local/include/boost/asio/impl/executor.hpp:142:3: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::context' requested here impl(const Executor& e, const Allocator& a) BOOST_ASIO_NOEXCEPT ^ /usr/local/include/boost/asio/impl/executor.hpp:137:30: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::impl' requested here impl* p = new (mem.ptr_) impl(e, a); ^ /usr/local/include/boost/asio/impl/executor.hpp:333:50: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::create' requested here : impl_(impl<Executor, std::allocator<void> >::create(e)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2155:18: note: in instantiation of function template specialization 'boost::asio::executor::executor<std::__1::reference_wrapper<boost::asio::io_context> >' requested here : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:868:15: note: expanded from macro '_VSTD' #define _VSTD std::_LIBCPP_ABI_NAMESPACE ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2258:9: note: in instantiation of function template specialization 'std::__1::__compressed_pair_elem<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, 1, false>::__compressed_pair_elem<std::__1::reference_wrapper<boost::asio::io_context> &&, 0>' requested here _Base2(__pc, _VSTD::move(__second_args), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3671:16: note: in instantiation of function template specialization 'std::__1::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > &, std::__1::reference_wrapper<boost::asio::io_context> &&>' requested here : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4330:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > >::__shared_ptr_emplace<std::__1::reference_wrapper<boost::asio::io_context> >' requested here ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4709:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::make_shared<std::__1::reference_wrapper<boost::asio::io_context> >' requested here return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); ^ ../../../../third_party/cpprestsdk/Release/libs/websocketpp/websocketpp/transport/asio/security/none.hpp:171:25: note: in instantiation of function template specialization 'std::__1::make_shared<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::reference_wrapper<boost::asio::io_context> >' requested here m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( ^ In file included from ../../../../third_party/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:14: In file included from ../../../../third_party/cpprestsdk/Release/src/pch/stdafx.h:103: In file included from ../../../../third_party/cpprestsdk/Release/include/cpprest/http_client.h:68: In file included from /usr/local/include/boost/asio/ssl.hpp:22: In file included from /usr/local/include/boost/asio/ssl/stream.hpp:29: In file included from /usr/local/include/boost/asio/ssl/detail/io.hpp:21: In file included from /usr/local/include/boost/asio/ssl/detail/stream_core.hpp:21: In file included from /usr/local/include/boost/asio/deadline_timer.hpp:24: In file included from /usr/local/include/boost/asio/basic_deadline_timer.hpp:31: In file included from /usr/local/include/boost/asio/executor.hpp:338: /usr/local/include/boost/asio/impl/executor.hpp:169:15: error: no member named 'on_work_started' in 'std::__1::reference_wrapper<boost::asio::io_context>' executor_.on_work_started(); ~~~~~~~~~ ^ /usr/local/include/boost/asio/impl/executor.hpp:142:3: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::on_work_started' requested here impl(const Executor& e, const Allocator& a) BOOST_ASIO_NOEXCEPT ^ /usr/local/include/boost/asio/impl/executor.hpp:137:30: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::impl' requested here impl* p = new (mem.ptr_) impl(e, a); ^ /usr/local/include/boost/asio/impl/executor.hpp:333:50: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::create' requested here : impl_(impl<Executor, std::allocator<void> >::create(e)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2155:18: note: in instantiation of function template specialization 'boost::asio::executor::executor<std::__1::reference_wrapper<boost::asio::io_context> >' requested here : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:868:15: note: expanded from macro '_VSTD' #define _VSTD std::_LIBCPP_ABI_NAMESPACE ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2258:9: note: in instantiation of function template specialization 'std::__1::__compressed_pair_elem<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, 1, false>::__compressed_pair_elem<std::__1::reference_wrapper<boost::asio::io_context> &&, 0>' requested here _Base2(__pc, _VSTD::move(__second_args), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3671:16: note: in instantiation of function template specialization 'std::__1::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > &, std::__1::reference_wrapper<boost::asio::io_context> &&>' requested here : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4330:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > >::__shared_ptr_emplace<std::__1::reference_wrapper<boost::asio::io_context> >' requested here ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4709:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::make_shared<std::__1::reference_wrapper<boost::asio::io_context> >' requested here return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); ^ ../../../../third_party/cpprestsdk/Release/libs/websocketpp/websocketpp/transport/asio/security/none.hpp:171:25: note: in instantiation of function template specialization 'std::__1::make_shared<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::reference_wrapper<boost::asio::io_context> >' requested here m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( ^ In file included from ../../../../third_party/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:14: In file included from ../../../../third_party/cpprestsdk/Release/src/pch/stdafx.h:103: In file included from ../../../../third_party/cpprestsdk/Release/include/cpprest/http_client.h:68: In file included from /usr/local/include/boost/asio/ssl.hpp:22: In file included from /usr/local/include/boost/asio/ssl/stream.hpp:29: In file included from /usr/local/include/boost/asio/ssl/detail/io.hpp:21: In file included from /usr/local/include/boost/asio/ssl/detail/stream_core.hpp:21: In file included from /usr/local/include/boost/asio/deadline_timer.hpp:24: In file included from /usr/local/include/boost/asio/basic_deadline_timer.hpp:31: In file included from /usr/local/include/boost/asio/executor.hpp:338: /usr/local/include/boost/asio/impl/executor.hpp:174:15: error: no member named 'on_work_finished' in 'std::__1::reference_wrapper<boost::asio::io_context>' executor_.on_work_finished(); ~~~~~~~~~ ^ /usr/local/include/boost/asio/impl/executor.hpp:142:3: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::on_work_finished' requested here impl(const Executor& e, const Allocator& a) BOOST_ASIO_NOEXCEPT ^ /usr/local/include/boost/asio/impl/executor.hpp:137:30: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::impl' requested here impl* p = new (mem.ptr_) impl(e, a); ^ /usr/local/include/boost/asio/impl/executor.hpp:333:50: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::create' requested here : impl_(impl<Executor, std::allocator<void> >::create(e)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2155:18: note: in instantiation of function template specialization 'boost::asio::executor::executor<std::__1::reference_wrapper<boost::asio::io_context> >' requested here : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:868:15: note: expanded from macro '_VSTD' #define _VSTD std::_LIBCPP_ABI_NAMESPACE ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2258:9: note: in instantiation of function template specialization 'std::__1::__compressed_pair_elem<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, 1, false>::__compressed_pair_elem<std::__1::reference_wrapper<boost::asio::io_context> &&, 0>' requested here _Base2(__pc, _VSTD::move(__second_args), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3671:16: note: in instantiation of function template specialization 'std::__1::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > &, std::__1::reference_wrapper<boost::asio::io_context> &&>' requested here : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4330:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > >::__shared_ptr_emplace<std::__1::reference_wrapper<boost::asio::io_context> >' requested here ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4709:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::make_shared<std::__1::reference_wrapper<boost::asio::io_context> >' requested here return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); ^ ../../../../third_party/cpprestsdk/Release/libs/websocketpp/websocketpp/transport/asio/security/none.hpp:171:25: note: in instantiation of function template specialization 'std::__1::make_shared<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::reference_wrapper<boost::asio::io_context> >' requested here m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( ^ In file included from ../../../../third_party/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:14: In file included from ../../../../third_party/cpprestsdk/Release/src/pch/stdafx.h:103: In file included from ../../../../third_party/cpprestsdk/Release/include/cpprest/http_client.h:68: In file included from /usr/local/include/boost/asio/ssl.hpp:22: In file included from /usr/local/include/boost/asio/ssl/stream.hpp:29: In file included from /usr/local/include/boost/asio/ssl/detail/io.hpp:21: In file included from /usr/local/include/boost/asio/ssl/detail/stream_core.hpp:21: In file included from /usr/local/include/boost/asio/deadline_timer.hpp:24: In file included from /usr/local/include/boost/asio/basic_deadline_timer.hpp:31: In file included from /usr/local/include/boost/asio/executor.hpp:338: /usr/local/include/boost/asio/impl/executor.hpp:184:15: error: no member named 'dispatch' in 'std::__1::reference_wrapper<boost::asio::io_context>' executor_.dispatch(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); ~~~~~~~~~ ^ /usr/local/include/boost/asio/impl/executor.hpp:142:3: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::dispatch' requested here impl(const Executor& e, const Allocator& a) BOOST_ASIO_NOEXCEPT ^ /usr/local/include/boost/asio/impl/executor.hpp:137:30: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::impl' requested here impl* p = new (mem.ptr_) impl(e, a); ^ /usr/local/include/boost/asio/impl/executor.hpp:333:50: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::create' requested here : impl_(impl<Executor, std::allocator<void> >::create(e)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2155:18: note: in instantiation of function template specialization 'boost::asio::executor::executor<std::__1::reference_wrapper<boost::asio::io_context> >' requested here : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:868:15: note: expanded from macro '_VSTD' #define _VSTD std::_LIBCPP_ABI_NAMESPACE ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2258:9: note: in instantiation of function template specialization 'std::__1::__compressed_pair_elem<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, 1, false>::__compressed_pair_elem<std::__1::reference_wrapper<boost::asio::io_context> &&, 0>' requested here _Base2(__pc, _VSTD::move(__second_args), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3671:16: note: in instantiation of function template specialization 'std::__1::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > &, std::__1::reference_wrapper<boost::asio::io_context> &&>' requested here : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4330:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > >::__shared_ptr_emplace<std::__1::reference_wrapper<boost::asio::io_context> >' requested here ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4709:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::make_shared<std::__1::reference_wrapper<boost::asio::io_context> >' requested here return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); ^ ../../../../third_party/cpprestsdk/Release/libs/websocketpp/websocketpp/transport/asio/security/none.hpp:171:25: note: in instantiation of function template specialization 'std::__1::make_shared<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::reference_wrapper<boost::asio::io_context> >' requested here m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( ^ In file included from ../../../../third_party/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:14: In file included from ../../../../third_party/cpprestsdk/Release/src/pch/stdafx.h:103: In file included from ../../../../third_party/cpprestsdk/Release/include/cpprest/http_client.h:68: In file included from /usr/local/include/boost/asio/ssl.hpp:22: In file included from /usr/local/include/boost/asio/ssl/stream.hpp:29: In file included from /usr/local/include/boost/asio/ssl/detail/io.hpp:21: In file included from /usr/local/include/boost/asio/ssl/detail/stream_core.hpp:21: In file included from /usr/local/include/boost/asio/deadline_timer.hpp:24: In file included from /usr/local/include/boost/asio/basic_deadline_timer.hpp:31: In file included from /usr/local/include/boost/asio/executor.hpp:338: /usr/local/include/boost/asio/impl/executor.hpp:189:15: error: no member named 'post' in 'std::__1::reference_wrapper<boost::asio::io_context>' executor_.post(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); ~~~~~~~~~ ^ /usr/local/include/boost/asio/impl/executor.hpp:142:3: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::post' requested here impl(const Executor& e, const Allocator& a) BOOST_ASIO_NOEXCEPT ^ /usr/local/include/boost/asio/impl/executor.hpp:137:30: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::impl' requested here impl* p = new (mem.ptr_) impl(e, a); ^ /usr/local/include/boost/asio/impl/executor.hpp:333:50: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::create' requested here : impl_(impl<Executor, std::allocator<void> >::create(e)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2155:18: note: in instantiation of function template specialization 'boost::asio::executor::executor<std::__1::reference_wrapper<boost::asio::io_context> >' requested here : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:868:15: note: expanded from macro '_VSTD' #define _VSTD std::_LIBCPP_ABI_NAMESPACE ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2258:9: note: in instantiation of function template specialization 'std::__1::__compressed_pair_elem<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, 1, false>::__compressed_pair_elem<std::__1::reference_wrapper<boost::asio::io_context> &&, 0>' requested here _Base2(__pc, _VSTD::move(__second_args), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3671:16: note: in instantiation of function template specialization 'std::__1::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > &, std::__1::reference_wrapper<boost::asio::io_context> &&>' requested here : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4330:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > >::__shared_ptr_emplace<std::__1::reference_wrapper<boost::asio::io_context> >' requested here ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4709:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::make_shared<std::__1::reference_wrapper<boost::asio::io_context> >' requested here return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); ^ ../../../../third_party/cpprestsdk/Release/libs/websocketpp/websocketpp/transport/asio/security/none.hpp:171:25: note: in instantiation of function template specialization 'std::__1::make_shared<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::reference_wrapper<boost::asio::io_context> >' requested here m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( ^ In file included from ../../../../third_party/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:14: In file included from ../../../../third_party/cpprestsdk/Release/src/pch/stdafx.h:103: In file included from ../../../../third_party/cpprestsdk/Release/include/cpprest/http_client.h:68: In file included from /usr/local/include/boost/asio/ssl.hpp:22: In file included from /usr/local/include/boost/asio/ssl/stream.hpp:29: In file included from /usr/local/include/boost/asio/ssl/detail/io.hpp:21: In file included from /usr/local/include/boost/asio/ssl/detail/stream_core.hpp:21: In file included from /usr/local/include/boost/asio/deadline_timer.hpp:24: In file included from /usr/local/include/boost/asio/basic_deadline_timer.hpp:31: In file included from /usr/local/include/boost/asio/executor.hpp:338: /usr/local/include/boost/asio/impl/executor.hpp:194:15: error: no member named 'defer' in 'std::__1::reference_wrapper<boost::asio::io_context>' executor_.defer(BOOST_ASIO_MOVE_CAST(function)(f), allocator_); ~~~~~~~~~ ^ /usr/local/include/boost/asio/impl/executor.hpp:142:3: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::defer' requested here impl(const Executor& e, const Allocator& a) BOOST_ASIO_NOEXCEPT ^ /usr/local/include/boost/asio/impl/executor.hpp:137:30: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::impl' requested here impl* p = new (mem.ptr_) impl(e, a); ^ /usr/local/include/boost/asio/impl/executor.hpp:333:50: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::create' requested here : impl_(impl<Executor, std::allocator<void> >::create(e)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2155:18: note: in instantiation of function template specialization 'boost::asio::executor::executor<std::__1::reference_wrapper<boost::asio::io_context> >' requested here : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:868:15: note: expanded from macro '_VSTD' #define _VSTD std::_LIBCPP_ABI_NAMESPACE ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2258:9: note: in instantiation of function template specialization 'std::__1::__compressed_pair_elem<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, 1, false>::__compressed_pair_elem<std::__1::reference_wrapper<boost::asio::io_context> &&, 0>' requested here _Base2(__pc, _VSTD::move(__second_args), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3671:16: note: in instantiation of function template specialization 'std::__1::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > &, std::__1::reference_wrapper<boost::asio::io_context> &&>' requested here : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4330:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > >::__shared_ptr_emplace<std::__1::reference_wrapper<boost::asio::io_context> >' requested here ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4709:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::make_shared<std::__1::reference_wrapper<boost::asio::io_context> >' requested here return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); ^ ../../../../third_party/cpprestsdk/Release/libs/websocketpp/websocketpp/transport/asio/security/none.hpp:171:25: note: in instantiation of function template specialization 'std::__1::make_shared<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::reference_wrapper<boost::asio::io_context> >' requested here m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( ^ In file included from ../../../../third_party/cpprestsdk/Release/src/websockets/client/ws_client_wspp.cpp:14: In file included from ../../../../third_party/cpprestsdk/Release/src/pch/stdafx.h:103: In file included from ../../../../third_party/cpprestsdk/Release/include/cpprest/http_client.h:68: In file included from /usr/local/include/boost/asio/ssl.hpp:22: In file included from /usr/local/include/boost/asio/ssl/stream.hpp:29: In file included from /usr/local/include/boost/asio/ssl/detail/io.hpp:21: In file included from /usr/local/include/boost/asio/ssl/detail/stream_core.hpp:21: In file included from /usr/local/include/boost/asio/deadline_timer.hpp:24: In file included from /usr/local/include/boost/asio/basic_deadline_timer.hpp:31: In file included from /usr/local/include/boost/asio/executor.hpp:338: /usr/local/include/boost/asio/impl/executor.hpp:218:22: error: invalid operands to binary expression ('const std::__1::reference_wrapper<boost::asio::io_context>' and 'const std::__1::reference_wrapper<boost::asio::io_context>') return executor_ == *static_cast<const Executor*>(e->target()); ~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/local/include/boost/asio/impl/executor.hpp:142:3: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::equals' requested here impl(const Executor& e, const Allocator& a) BOOST_ASIO_NOEXCEPT ^ /usr/local/include/boost/asio/impl/executor.hpp:137:30: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::impl' requested here impl* p = new (mem.ptr_) impl(e, a); ^ /usr/local/include/boost/asio/impl/executor.hpp:333:50: note: in instantiation of member function 'boost::asio::executor::impl<std::__1::reference_wrapper<boost::asio::io_context>, std::__1::allocator<void> >::create' requested here : impl_(impl<Executor, std::allocator<void> >::create(e)) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2155:18: note: in instantiation of function template specialization 'boost::asio::executor::executor<std::__1::reference_wrapper<boost::asio::io_context> >' requested here : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:868:15: note: expanded from macro '_VSTD' #define _VSTD std::_LIBCPP_ABI_NAMESPACE ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2258:9: note: in instantiation of function template specialization 'std::__1::__compressed_pair_elem<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, 1, false>::__compressed_pair_elem<std::__1::reference_wrapper<boost::asio::io_context> &&, 0>' requested here _Base2(__pc, _VSTD::move(__second_args), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3671:16: note: in instantiation of function template specialization 'std::__1::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >, boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::__compressed_pair<std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > &, std::__1::reference_wrapper<boost::asio::io_context> &&>' requested here : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a), ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4330:26: note: in instantiation of function template specialization 'std::__1::__shared_ptr_emplace<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::allocator<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> > >::__shared_ptr_emplace<std::__1::reference_wrapper<boost::asio::io_context> >' requested here ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...); ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4709:29: note: in instantiation of function template specialization 'std::__1::shared_ptr<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor> >::make_shared<std::__1::reference_wrapper<boost::asio::io_context> >' requested here return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...); ^ ../../../../third_party/cpprestsdk/Release/libs/websocketpp/websocketpp/transport/asio/security/none.hpp:171:25: note: in instantiation of function template specialization 'std::__1::make_shared<boost::asio::basic_stream_socket<boost::asio::ip::tcp, boost::asio::executor>, std::__1::reference_wrapper<boost::asio::io_context> >' requested here m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/system_error:390:1: note: candidate function not viable: no known conversion from 'const std::__1::reference_wrapper<boost::asio::io_context>' to 'const std::__1::error_code' for 1st argument operator==(const error_code& __x, const error_code& __y) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/system_error:397:1: note: candidate function not viable: no known conversion from 'const std::__1::reference_wrapper<boost::asio::io_context>' to 'const std::__1::error_code' for 1st argument operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/system_error:405:1: note: candidate function not viable: no known conversion from 'const std::__1::reference_wrapper<boost::asio::io_context>' to 'const std::__1::error_condition' for 1st argument operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/system_error:412:1: note: candidate function not viable: no known conversion from 'const std::__1::reference_wrapper<boost::asio::io_context>' to 'const std::__1::error_condition' for 1st argument operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/utility:579:1: note: candidate template ignored: could not match 'pair' against 'reference_wrapper' operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:723:1: note: candidate template ignored: could not match 'reverse_iterator' against 'reference_wrapper' operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:952:1: note: candidate template ignored: could not match 'istream_iterator' against 'reference_wrapper' operator==(const istream_iterator<_Tp, _CharT, _Traits, _Distance>& __x, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:1056:6: note: candidate template ignored: could not match 'istreambuf_iterator' against 'reference_wrapper' bool operator==(const istreambuf_iterator<_CharT,_Traits>& __a, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:1159:1: note: candidate template ignored: could not match 'move_iterator' against 'reference_wrapper' operator==(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/iterator:1531:1: note: candidate template ignored: could not match '__wrap_iter' against 'reference_wrapper' operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/tuple:1121:1: note: candidate template ignored: could not match 'tuple' against 'reference_wrapper' operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:1986:6: note: candidate template ignored: could not match 'allocator' against 'reference_wrapper' bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2963:1: note: candidate template ignored: could not match 'unique_ptr' against 'reference_wrapper' operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() == __y.get();} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:2999:1: note: candidate template ignored: could not match 'unique_ptr' against 'reference_wrapper' operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:3007:1: note: candidate template ignored: could not match 'unique_ptr' against 'reference_wrapper' operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4795:1: note: candidate template ignored: could not match 'shared_ptr' against 'reference_wrapper' operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4849:1: note: candidate template ignored: could not match 'shared_ptr' against 'reference_wrapper' operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4857:1: note: candidate template ignored: could not match 'shared_ptr' against 'reference_wrapper' operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:2452:1: note: candidate template ignored: could not match 'function' against 'reference_wrapper' operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/functional:2457:1: note: candidate template ignored: could not match 'function' against 'reference_wrapper' operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;} ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:613:6: note: candidate template ignored: could not match 'basic_string_view' against 'reference_wrapper' bool operator==(basic_string_view<_CharT, _Traits> __lhs, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:622:6: note: candidate template ignored: could not match 'basic_string_view' against 'reference_wrapper' bool operator==(basic_string_view<_CharT, _Traits> __lhs, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string_view:631:6: note: candidate template ignored: could not match 'basic_string_view' against 'reference_wrapper' bool operator==(typename common_type<basic_string_view<_CharT, _Traits> >::type __lhs, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:563:6: note: candidate template ignored: could not match 'fpos' against 'reference_wrapper' bool operator==(const fpos<_StateT>& __x, const fpos<_StateT>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:3834:1: note: candidate template ignored: could not match 'basic_string' against 'reference_wrapper' operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:3846:1: note: candidate template ignored: could not match 'basic_string' against 'reference_wrapper' operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:3865:1: note: candidate template ignored: could not match 'const _CharT *' against 'std::__1::reference_wrapper<boost::asio::io_context>' operator==(const _CharT* __lhs, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/string:3878:1: note: candidate template ignored: could not match 'basic_string' against 'reference_wrapper' operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, ^ /usr/local/include/boost/bind/arg.hpp:48:40: note: candidate template ignored: could not match 'arg' against 'reference_wrapper' template< int I > BOOST_CONSTEXPR bool operator==( arg<I> const &, arg<I> const & ) ^ /usr/local/include/boost/smart_ptr/shared_ptr.hpp:823:40: note: candidate template ignored: could not match 'shared_ptr' against 'reference_wrapper' template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b) BOOST_SP_NOEXCEPT ^ /usr/local/include/boost/smart_ptr/shared_ptr.hpp:846:31: note: candidate template ignored: could not match 'shared_ptr' against 'reference_wrapper' template<class T> inline bool operator==( shared_ptr<T> const & p, boost::detail::sp_nullptr_t ) BOOST_SP_NOEXCEPT ^ /usr/local/include/boost/smart_ptr/shared_ptr.hpp:851:31: note: candidate template ignored: could not match 'shared_ptr' against 'reference_wrapper' template<class T> inline bool operator==( boost::detail::sp_nullptr_t, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:1562:1: note: candidate template ignored: could not match 'map' against 'reference_wrapper' operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/map:2111:1: note: candidate template ignored: could not match 'multimap' against 'reference_wrapper' operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/vector:3360:1: note: candidate template ignored: could not match 'vector' against 'reference_wrapper' operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/deque:2880:1: note: candidate template ignored: could not match 'deque' against 'reference_wrapper' operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/stack:256:1: note: candidate template ignored: could not match 'stack' against 'reference_wrapper' operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/array:371:1: note: candidate template ignored: could not match 'array' against 'reference_wrapper' operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/random:2393:1: note: candidate template ignored: could not match 'mersenne_twister_engine' against 'reference_wrapper' operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/random:2718:1: note: candidate template ignored: could not match 'subtract_with_carry_engine' against 'reference_wrapper' operator==( ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/random:2936:1: note: candidate template ignored: could not match 'discard_block_engine' against 'reference_wrapper' operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/random:3187:1: note: candidate template ignored: could not match 'independent_bits_engine' against 'reference_wrapper' operator==( ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/random:3418:1: note: candidate template ignored: could not match 'shuffle_order_engine' against 'reference_wrapper' operator==( ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:1642:1: note: candidate template ignored: could not match 'unordered_map' against 'reference_wrapper' operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/unordered_map:2269:1: note: candidate template ignored: could not match 'unordered_multimap' against 'reference_wrapper' operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, ^ /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/queue:362:1: note: candidate template ignored: could not match 'queue' against 'reference_wrapper' operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y) ^ 7 errors generated. ninja: build stopped: subcommand failed.

Session restore causes crash on Linux

There seems to be an issue in the Nakama cpp wrapper library for Linux. Restoring a session using the Nakama wrapper results in the following uncaught exception:

[2021.12.14-19.24.25:569][968]LogTemp: [Nakama::RestClient::RestClient] Created. NakamaSdkVersion: 2.5.0
[2021.12.14-19.24.25:569][968]ProjectVNakama: existing session found, restoring session
[2021.12.14-19.24.25:570][968]ProjectVNakama: Stored session token in GameInstance
[2021.12.14-19.24.25:570][968]ProjectVNakama: Handling nakama session, creating Real Time Client instance, assigning listeners and triggering connect (Owner: BP_GameModeProcedural_C_2147482195)
[2021.12.14-19.24.25:570][968]LogTemp: [NRtClient::NRtClient] Created
[2021.12.14-19.24.25:570][968]LogTemp: [NRtClient::connect] ...
CommonUnixCrashHandler: Signal=5
[2021.12.14-19.24.25:602][968]LogCore: === Critical error: ===
Unhandled Exception: SIGTRAP: trace trap

[2021.12.14-19.24.25:602][968]LogCore: Fatal error!

0x00007f7082cc624b libpthread.so.0!raise(+0xcb)
0x00007f7081f70e52 libnakama-cpp.so!UnknownFunction(0x123e51)
0x00007f7081f53ae8 libnakama-cpp.so!_ZNSt16_Sp_counted_baseILN9__gnu_cxx12_Lock_policyE2EE10_M_releaseEv(+0x47)
0x00007f7082141c3c libnakama-cpp.so!UnknownFunction(0x2f4c3b)
0x00007f708223e396 libnakama-cpp.so!UnknownFunction(0x3f1395)
0x00007f70821aa593 libnakama-cpp.so!_ZN5boost4asio6detail9scheduler3runERNS_6system10error_codeE(+0x4a2)
0x00007f708223f116 libnakama-cpp.so!UnknownFunction(0x3f2115)
0x00007f7082193404 libnakama-cpp.so!boost_asio_detail_posix_thread_function(+0x13)
0x00007f7082cba609 libpthread.so.0!UnknownFunction(0x9608)
0x00007f7081c2e293 libc.so.6!clone(+0x42)

[2021.12.14-19.24.25:604][968]LogExit: Executing StaticShutdownAfterError

The same code causing this issue on Linux works as intended on Windows.

Input payload differences between Rest and RT clients

We've noted that:
The Rest client:

void RestClient::rpc( NSessionPtr session, const std::string & id, const opt::optional<std::string>& payload, std::function<void(const NRpc&)> successCallback, ErrorCallback errorCallback)

works with a regular JSON encoded string for payload
where the RT Client:

void NRtClient::rpc(const std::string & id, const opt::optional<std::string>& payload, std::function<void(const NRpc&)> successCallback, RtErrorCallback errorCallback)

Will not work unless you JSON encode the JSON encoded string (as second time).

This has caused some head scratching a few times since the Nakama server will return an error (which does not end up in the error log) if you provide a JSON encoded string (only encoded once).

It would be really nice if those two rpc functions acted the same (they have the same signature) and the RT one did the extra encoding/escaping internally as needed.

Thoughts?

Move library to C instead of C++

Problem:
Having the library written directly in C++ is good, when the client uses stdlib themselves. Yet as soon as the client uses their own version of certain types (e.g. UE4s smart pointers) interfacing with each other becomes much harder and often involves converting the type from C++ to C and then the clients version of the type. Another solution would be to forego the client types altogether and stick with stdlib, which sometimes isn't possible

Solution:
Move the C++ implementation to C. Since C is the least common denominator in most cases many libraries would benefit from a singular codebase (e.g. UE4, Android, Swift users). In addition clients, who implement their own versions of certain C++ std types, more often than not accept plain C types as arguments.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.