From f37edbd71ce1886a67d73966511aa9f516574d28 Mon Sep 17 00:00:00 2001 From: tt2468 Date: Mon, 30 Aug 2021 01:39:46 -0700 Subject: [PATCH] EventHandler: Include required event intent in emit --- docs/partials/introduction.md | 3 +++ src/WebSocketServer.cpp | 1 + 2 files changed, 4 insertions(+) diff --git a/docs/partials/introduction.md b/docs/partials/introduction.md index a81063d0..0a51bed1 100644 --- a/docs/partials/introduction.md +++ b/docs/partials/introduction.md @@ -460,9 +460,11 @@ Authentication is not required ``` { "eventType": string, + "eventIntent": number, "eventData": object(optional) } ``` +- `eventIntent` is the original intent required to be subscribed to in order to receive the event. **Example Message:** ```json @@ -470,6 +472,7 @@ Authentication is not required "op": 2, "d": { "eventType": "StudioModeStateChanged", + "eventIntent": 1, "eventData": { "studioModeEnabled": true } diff --git a/src/WebSocketServer.cpp b/src/WebSocketServer.cpp index c1fe6b39..1096b184 100644 --- a/src/WebSocketServer.cpp +++ b/src/WebSocketServer.cpp @@ -199,6 +199,7 @@ void WebSocketServer::BroadcastEvent(uint64_t requiredIntent, std::string eventT json eventMessage; eventMessage["op"] = 5; eventMessage["d"]["eventType"] = eventType; + eventMessage["d"]["eventIntent"] = requiredIntent; if (eventData.is_object()) eventMessage["d"]["eventData"] = eventData;