Skip to content

CPP Library implementing UAT server for asio/websocketpp

License

Notifications You must be signed in to change notification settings

black-sliver/UATServerPP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UATServerPP

Header-only C++ library implementing UAT server for asio/websocketpp.

See here for protocol description.

How to build

  • define ASIO_BOOST or ASIO_STANDALONE project-wide or before including
  • #include <uatserverpp.hpp>
  • add other header libraries to the include path in you Makefile or project:
  • if you build with mingw on windows you may want to patch asio to allow std::thread for mingw
  • see UATBridge/Makefile for an example

How to use

#include <list>
#include <uatserverpp.hpp>
UAT::Server* server;
asio::io_service service;

void run() {
    server = new UAT::Server(&service);
    server->set_name("Name of the Game or Mod");
    server->set_version("1.00");
    server->set_slots({"Player 1", "Player 2"}); // optional slots
    server->start(); // start to listen
    service.run(); // or any other way to poll the asio service
}

void some_service_callback() {
    std::list<UAT::Var> vars = {
        {"Player 1", "sword", 1} // slot is "" if there are no slots
    };
    server->set_vars(vars);
}

void some_other_callback() {
    service.post(some_service_callback); // run code inside asio service thread
}

see UATBridge for a complete example.

About

CPP Library implementing UAT server for asio/websocketpp

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages