add example websocket C++ server snake which supports basic cobra ops (publish and subscribe without stream sql

This commit is contained in:
Benjamin Sergeant
2019-04-22 17:24:01 -07:00
parent 9ab7bc652a
commit c85d5da111
19 changed files with 846 additions and 20 deletions

46
ws/snake/IXAppConfig.h Normal file
View File

@ -0,0 +1,46 @@
/*
* IXAppConfig.h
* Author: Benjamin Sergeant
* Copyright (c) 2019 Machine Zone, Inc. All rights reserved.
*/
#pragma once
#include <string>
#include <vector>
#include "nlohmann/json.hpp"
namespace snake
{
struct AppConfig
{
// Server
std::string hostname;
int port;
// Redis
std::vector<std::string> redisHosts;
int redisPort;
std::string redisPassword;
// AppKeys
nlohmann::json apps;
// Misc
bool verbose;
};
bool isAppKeyValid(
const AppConfig& appConfig,
std::string appkey);
std::string getRoleSecret(
const AppConfig& appConfig,
std::string appkey,
std::string role);
std::string generateNonce();
void dumpConfig(const AppConfig& appConfig);
}