mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
adding error response object method
This commit is contained in:
parent
b9ae28483c
commit
1d30f13fd8
@ -189,6 +189,17 @@ void WSRequestHandler::SendErrorResponse(const char* errorMessage) {
|
||||
SendResponse(response);
|
||||
}
|
||||
|
||||
void WSRequestHandler::SendErrorResponse(obs_data_t* additionalFields) {
|
||||
obs_data_t* response = obs_data_create();
|
||||
obs_data_set_string(response, "status", "error");
|
||||
obs_data_set_string(response, "message-id", _messageId);
|
||||
|
||||
if (additionalFields)
|
||||
obs_data_set_obj(response, "error", additionalFields);
|
||||
|
||||
SendResponse(response);
|
||||
}
|
||||
|
||||
void WSRequestHandler::SendResponse(obs_data_t* response) {
|
||||
const char *json = obs_data_get_json(response);
|
||||
_client->sendTextMessage(json);
|
||||
|
@ -47,6 +47,7 @@ class WSRequestHandler : public QObject {
|
||||
|
||||
void SendOKResponse(obs_data_t* additionalFields = NULL);
|
||||
void SendErrorResponse(const char* errorMessage);
|
||||
void SendErrorResponse(obs_data_t* additionalFields = NULL);
|
||||
void SendResponse(obs_data_t* response);
|
||||
|
||||
static void HandleGetVersion(WSRequestHandler* req);
|
||||
|
Loading…
x
Reference in New Issue
Block a user