add missing file

This commit is contained in:
Benjamin Sergeant 2019-06-23 13:35:04 -07:00
parent 19a959dc31
commit f458cd297e

34
ws/ws_httpd.cpp Normal file
View File

@ -0,0 +1,34 @@
/*
* ws_httpd.cpp
* Author: Benjamin Sergeant
* Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
*/
#include <iostream>
#include <vector>
#include <fstream>
#include <sstream>
#include <ixwebsocket/IXHttpServer.h>
#include <spdlog/spdlog.h>
namespace ix
{
int ws_httpd_main(int port, const std::string& hostname)
{
spdlog::info("Listening on {}:{}", hostname, port);
ix::HttpServer server(port, hostname);
auto res = server.listen();
if (!res.first)
{
std::cerr << res.second << std::endl;
return 1;
}
server.start();
server.wait();
return 0;
}
}