Skip to content

Commit 8831833

Browse files
committed
Add functions event;
1 parent ca03d46 commit 8831833

1 file changed

Lines changed: 22 additions & 2 deletions

File tree

StreamlabsAPI.cpp

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,33 @@ bool StreamlabsAPI::connect(const char* socketToken) {
1515
webSocket.beginSSL(SL_HOSTNAME, SL_PORT, queryParams.c_str(), SL_FINGERPRINT);
1616
}
1717

18-
1918
void StreamlabsAPI::followTwitchEvent(std::function<void (const char * payload)> func) {
2019
events["follow"] = func;
2120
}
2221

22+
void StreamlabsAPI::subscriptionsTwitchEvent(std::function<void (const char * payload)> func) {
23+
events["subscription"] = func;
24+
}
25+
26+
void StreamlabsAPI::hostTwitchEvent(std::function<void (const char * payload)> func) {
27+
events["host"] = func;
28+
}
29+
30+
void StreamlabsAPI::bitsTwitchEvent(std::function<void (const char * payload)> func) {
31+
events["bits"] = func;
32+
}
33+
34+
void StreamlabsAPI::raidsTwitchEvent(std::function<void (const char * payload)> func) {
35+
events["raid"] = func;
36+
}
37+
38+
void StreamlabsAPI::donationEvent(std::function<void (const char * payload)> func) {
39+
events["donation"] = func;
40+
}
41+
42+
StaticJsonDocument<10000> doc;
2343
void StreamlabsAPI::event(const char * payload, size_t length) {
24-
StaticJsonDocument<200> doc;
44+
// FIXME remove deserialized and parse string to get the type
2545
DeserializationError error = deserializeJson(doc, payload);
2646
if (error) {
2747
Serial.print("deserializeJson() failed: ");

0 commit comments

Comments
 (0)