mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
WebSocketServer: Add parts for availableRequests/availableEvents
This commit is contained in:
parent
45367a7355
commit
df8ef87dc5
@ -138,6 +138,15 @@ WebSocketProtocol::ProcessResult WebSocketProtocol::ProcessMessage(SessionPtr se
|
||||
return ret;
|
||||
} else if (messageType == "Reidentify") {
|
||||
std::unique_lock<std::mutex> sessionLock(session->OperationMutex);
|
||||
|
||||
WebSocketProtocol::ProcessResult parameterResult = SetSessionParameters(session, incomingMessage);
|
||||
if (ret.closeCode != WebSocketServer::WebSocketCloseCode::DontClose) {
|
||||
return parameterResult;
|
||||
}
|
||||
|
||||
ret.result["messageType"] = "Identified";
|
||||
ret.result["negotiatedRpcVersion"] = session->RpcVersion();
|
||||
return ret;
|
||||
} else {
|
||||
if (!session->IgnoreInvalidMessages()) {
|
||||
ret.closeCode = WebSocketServer::WebSocketCloseCode::UnknownMessageType;
|
||||
|
@ -19,4 +19,7 @@ namespace WebSocketProtocol {
|
||||
};
|
||||
|
||||
ProcessResult ProcessMessage(SessionPtr session, json incomingMessage);
|
||||
|
||||
std::vector<std::string> GetRequestList();
|
||||
std::vector<std::string> GetEventList();
|
||||
}
|
||||
|
@ -276,7 +276,8 @@ void WebSocketServer::onOpen(websocketpp::connection_hdl hdl)
|
||||
helloMessage["messageType"] = "Hello";
|
||||
helloMessage["obsWebSocketVersion"] = OBS_WEBSOCKET_VERSION;
|
||||
helloMessage["rpcVersion"] = OBS_WEBSOCKET_RPC_VERSION;
|
||||
// todo: Add request and event lists
|
||||
helloMessage["availableRequests"] = WebSocketProtocol::GetRequestList();
|
||||
helloMessage["availableEvents"] = WebSocketProtocol::GetEventList();
|
||||
if (AuthenticationRequired) {
|
||||
std::string sessionChallenge = Utils::Crypto::GenerateSalt();
|
||||
session->SetChallenge(sessionChallenge);
|
||||
|
Loading…
Reference in New Issue
Block a user