mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
requesthandler: Don't require session for Request Handler
Required to call requests in situations where a session is not relevant.
This commit is contained in:
parent
1cd12c1023
commit
3303acfcca
@ -37,7 +37,7 @@ typedef RequestResult(RequestHandler::*RequestMethodHandler)(const Request&);
|
||||
|
||||
class RequestHandler {
|
||||
public:
|
||||
RequestHandler(SessionPtr session);
|
||||
RequestHandler(SessionPtr session = nullptr);
|
||||
|
||||
RequestResult ProcessRequest(const Request& request);
|
||||
std::vector<std::string> GetRequestList();
|
||||
|
@ -92,8 +92,13 @@ RequestResult RequestHandler::GetStats(const Request&)
|
||||
{
|
||||
json responseData = Utils::Obs::ObjectHelper::GetStats();
|
||||
|
||||
responseData["webSocketSessionIncomingMessages"] = _session->IncomingMessages();
|
||||
responseData["webSocketSessionOutgoingMessages"] = _session->OutgoingMessages();
|
||||
if (_session) {
|
||||
responseData["webSocketSessionIncomingMessages"] = _session->IncomingMessages();
|
||||
responseData["webSocketSessionOutgoingMessages"] = _session->OutgoingMessages();
|
||||
} else {
|
||||
responseData["webSocketSessionIncomingMessages"] = nullptr;
|
||||
responseData["webSocketSessionOutgoingMessages"] = nullptr;
|
||||
}
|
||||
|
||||
return RequestResult::Success(responseData);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user