mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
WebSocketServer: Add RPC version support to events
This commit is contained in:
parent
921bc81a7b
commit
4d6901c075
@ -186,7 +186,7 @@ std::vector<WebSocketServer::WebSocketSessionState> WebSocketServer::GetWebSocke
|
|||||||
}
|
}
|
||||||
|
|
||||||
// It isn't consistent to directly call the WebSocketServer from the events system, but it would also be dumb to make it unnecessarily complicated.
|
// It isn't consistent to directly call the WebSocketServer from the events system, but it would also be dumb to make it unnecessarily complicated.
|
||||||
void WebSocketServer::BroadcastEvent(uint64_t requiredIntent, std::string eventType, json eventData)
|
void WebSocketServer::BroadcastEvent(uint64_t requiredIntent, std::string eventType, json eventData, uint8_t rpcVersion)
|
||||||
{
|
{
|
||||||
if (!_server.is_listening())
|
if (!_server.is_listening())
|
||||||
return;
|
return;
|
||||||
@ -209,6 +209,9 @@ void WebSocketServer::BroadcastEvent(uint64_t requiredIntent, std::string eventT
|
|||||||
if (!it.second->IsIdentified()) {
|
if (!it.second->IsIdentified()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (rpcVersion && it.second->RpcVersion() != rpcVersion) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if ((it.second->EventSubscriptions() & requiredIntent) != 0) {
|
if ((it.second->EventSubscriptions() & requiredIntent) != 0) {
|
||||||
websocketpp::lib::error_code errorCode;
|
websocketpp::lib::error_code errorCode;
|
||||||
switch (it.second->Encoding()) {
|
switch (it.second->Encoding()) {
|
||||||
|
@ -79,7 +79,7 @@ class WebSocketServer : QObject
|
|||||||
std::string AuthenticationSalt;
|
std::string AuthenticationSalt;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void BroadcastEvent(uint64_t requiredIntent, std::string eventType, json eventData = nullptr);
|
void BroadcastEvent(uint64_t requiredIntent, std::string eventType, json eventData = nullptr, uint8_t rpcVersion = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void ClientIdentified(const WebSocketSessionState state);
|
void ClientIdentified(const WebSocketSessionState state);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user