RelayServer.h 893 Bytes
Newer Older
Hubert Denkmair's avatar
Hubert Denkmair committed
1 2
#pragma once

Hubert Denkmair's avatar
Hubert Denkmair committed
3
#include <uWS.h>
Hubert Denkmair's avatar
Hubert Denkmair committed
4
#include "TcpProtocol.h"
5
#include "WebsocketConnection.h"
Hubert Denkmair's avatar
Hubert Denkmair committed
6 7 8 9 10 11 12

class RelayServer
{
	public:
		RelayServer();
		int Run();
	private:
Hubert Denkmair's avatar
Hubert Denkmair committed
13
		int _clientSocket;
14
		TcpProtocol _tcpProtocol;
15
		std::string _statsHTTPResponse;
16 17 18 19 20 21 22

		static constexpr const char* ENV_GAMESERVER_HOST = "GAMESERVER_HOST";
		static constexpr const char* ENV_GAMESERVER_HOST_DEFAULT = "localhost";
		static constexpr const char* ENV_GAMESERVER_PORT = "GAMESERVER_PORT";
		static constexpr const char* ENV_GAMESERVER_PORT_DEFAULT = "9010";
		static constexpr const char* ENV_WEBSOCKET_PORT = "WEBSOCKET_PORT";
		static constexpr const char* ENV_WEBSOCKET_PORT_DEFAULT = "9009";
Hubert Denkmair's avatar
Hubert Denkmair committed
23
		static constexpr const size_t MAX_CLIENT_MESSAGE_SIZE = 10*1024;
24 25
		static int connectTcpSocket(const char* hostname, const char* port);
		static const char* getEnvOrDefault(const char* envVar, const char* defaultValue);
Hubert Denkmair's avatar
Hubert Denkmair committed
26
};