Windows support (no TLS yet)

This commit is contained in:
Benjamin Sergeant
2018-10-08 21:42:45 -07:00
parent 88c2e1f6de
commit 16805759d3
5 changed files with 116 additions and 45 deletions

View File

@ -13,6 +13,7 @@
#include <sstream>
#include <queue>
#include <ixwebsocket/IXWebSocket.h>
#include <ixwebsocket/IXSocket.h>
#include "nlohmann/json.hpp"
@ -158,13 +159,10 @@ namespace
_webSocket.send(encodeMessage(text));
}
void interactiveMain()
void interactiveMain(const std::string& user)
{
std::string user(getenv("USER"));
WebSocketChat webSocketChat(user);
std::cout << "Type Ctrl-D to exit prompt..." << std::endl;
WebSocketChat webSocketChat(user);
webSocketChat.start();
while (true)
@ -186,8 +184,15 @@ namespace
}
}
int main()
int main(int argc, char** argv)
{
interactiveMain();
std::string user("user");
if (argc == 2)
{
user = argv[1];
}
Socket::init();
interactiveMain(user);
return 0;
}