more fixes, works now (atleast without auth)
This commit is contained in:
parent
bd411ce2ba
commit
070364018e
1 changed files with 7 additions and 15 deletions
20
src/main.cpp
20
src/main.cpp
|
@ -1,4 +1,4 @@
|
||||||
#define LED_COUNT 19
|
#define LED_COUNT 10
|
||||||
#define LED_BRIGHTNESS 100
|
#define LED_BRIGHTNESS 100
|
||||||
#define LED_PIN 12
|
#define LED_PIN 12
|
||||||
|
|
||||||
|
@ -79,9 +79,6 @@ void handleWebSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
|
||||||
// Find out if we need authentication
|
// Find out if we need authentication
|
||||||
#ifdef OBS_PASS
|
#ifdef OBS_PASS
|
||||||
webSocket.sendTXT("{\"request-type\":\"GetAuthRequired\",\"message-id\":\"1\"}");
|
webSocket.sendTXT("{\"request-type\":\"GetAuthRequired\",\"message-id\":\"1\"}");
|
||||||
#else
|
|
||||||
webSocket.sendTXT("{\"request-type\":\"GetCurrentScene\",\"message-id\":\"1\"}");
|
|
||||||
webSocket.sendTXT("{\"request-type\":\"GetPreviewScene\",\"message-id\":\"2\"}");
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -137,11 +134,11 @@ void handleWebSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
|
||||||
webSocket.sendTXT(authRequest);
|
webSocket.sendTXT(authRequest);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} else if (doc.containsKey("message-id") && (doc["message-id"]) == "2") {
|
} else if (doc.containsKey("message-id") && doc["message-id"] == "2") {
|
||||||
if (strcmp(doc["status"], "ok") == 0) {
|
if (strcmp(doc["status"], "ok") == 0) {
|
||||||
Serial.println("[OBS] authentication successful");
|
Serial.println("[OBS] authentication successful");
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Authenticated FAILED");
|
Serial.println("[OBS] authentication FAILED");
|
||||||
set_error();
|
set_error();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -157,13 +154,13 @@ void handleWebSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(doc["update-type"], "SwitchScenes") == 0 || strcmp(doc["update-type"], "GetCurrentScene") == 0) {
|
if (strcmp(doc["update-type"], "SwitchScenes") == 0) {
|
||||||
if (my_source_in_current_event) {
|
if (my_source_in_current_event) {
|
||||||
is_currently_live = true;
|
is_currently_live = true;
|
||||||
} else {
|
} else {
|
||||||
is_currently_live = false;
|
is_currently_live = false;
|
||||||
}
|
}
|
||||||
} else if (strcmp(doc["update-type"], "PreviewSceneChanged") == 0 || strcmp(doc["update-type"], "GetPreviewScene") == 0) {
|
} else if (strcmp(doc["update-type"], "PreviewSceneChanged") == 0) {
|
||||||
if (my_source_in_current_event) {
|
if (my_source_in_current_event) {
|
||||||
is_currently_preview = true;
|
is_currently_preview = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -186,14 +183,9 @@ void handleWebSocketEvent(WStype_t type, uint8_t * payload, size_t length) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case WStype_BIN:
|
|
||||||
case WStype_ERROR:
|
|
||||||
case WStype_FRAGMENT_TEXT_START:
|
|
||||||
case WStype_FRAGMENT_BIN_START:
|
|
||||||
case WStype_FRAGMENT:
|
|
||||||
case WStype_FRAGMENT_FIN:
|
|
||||||
case WStype_PING:
|
case WStype_PING:
|
||||||
case WStype_PONG:
|
case WStype_PONG:
|
||||||
|
Serial.println("[WS] ping/pong");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue