mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
The WebSocket system is now fully split up. The global network module initialization is moved to DLL init so the websocket class could be used for anything. The LiveAPI system now also mostly runs in the server frame thread, the convar change callbacks still need to be latched to the server frame thread however.
41 lines
806 B
C++
41 lines
806 B
C++
#ifndef RTECH_LIVEAPI_H
|
|
#define RTECH_LIVEAPI_H
|
|
#include "tier2/websocket.h"
|
|
|
|
#define LIVE_API_MAX_FRAME_BUFFER_SIZE 0x8000
|
|
|
|
extern ConVar liveapi_enabled;
|
|
extern ConVar liveapi_session_name;
|
|
|
|
struct ProtoWebSocketRefT;
|
|
typedef void (*LiveAPISendCallback_t)(ProtoWebSocketRefT* webSocket);
|
|
|
|
class LiveAPI
|
|
{
|
|
public:
|
|
|
|
LiveAPI();
|
|
|
|
void Init();
|
|
void Shutdown();
|
|
|
|
void CreateParams(CWebSocket::ConnParams_s& params);
|
|
void UpdateParams();
|
|
|
|
bool InitWebSocket(const char*& initError);
|
|
void InstallAddressList();
|
|
|
|
void RunFrame();
|
|
void LogEvent(const char* const dataBuf, const int32_t dataSize);
|
|
|
|
bool IsEnabled() const;
|
|
inline bool WebSocketInitialized() const { return webSocketSystem.IsInitialized(); }
|
|
|
|
private:
|
|
CWebSocket webSocketSystem;
|
|
};
|
|
|
|
LiveAPI* LiveAPISystem();
|
|
|
|
#endif // RTECH_LIVEAPI_H
|