mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
WebSocketServer: Make QObject again
This commit is contained in:
parent
0370b5882d
commit
b43fc4fec6
@ -13,6 +13,7 @@
|
|||||||
#include "plugin-macros.generated.h"
|
#include "plugin-macros.generated.h"
|
||||||
|
|
||||||
WebSocketServer::WebSocketServer() :
|
WebSocketServer::WebSocketServer() :
|
||||||
|
QObject(nullptr),
|
||||||
_sessions()
|
_sessions()
|
||||||
{
|
{
|
||||||
// Randomize the random number generator
|
// Randomize the random number generator
|
||||||
@ -196,11 +197,6 @@ void WebSocketServer::BroadcastEvent(uint64_t requiredIntent, std::string eventT
|
|||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketSession *WebSocketServer::GetWebSocketSession(websocketpp::connection_hdl hdl)
|
|
||||||
{
|
|
||||||
return new WebSocketSession();
|
|
||||||
}
|
|
||||||
|
|
||||||
void WebSocketServer::onOpen(websocketpp::connection_hdl hdl)
|
void WebSocketServer::onOpen(websocketpp::connection_hdl hdl)
|
||||||
{
|
{
|
||||||
auto conn = _server.get_con_from_hdl(hdl);
|
auto conn = _server.get_con_from_hdl(hdl);
|
||||||
|
@ -12,8 +12,10 @@
|
|||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
class WebSocketServer
|
class WebSocketServer : QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum WebSocketCloseCode: uint16_t {
|
enum WebSocketCloseCode: uint16_t {
|
||||||
UnknownReason = 4000,
|
UnknownReason = 4000,
|
||||||
@ -71,11 +73,11 @@ class WebSocketServer
|
|||||||
|
|
||||||
std::string GetConnectUrl();
|
std::string GetConnectUrl();
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void ServerRunner();
|
void ServerRunner();
|
||||||
WebSocketSession *GetWebSocketSession(websocketpp::connection_hdl hdl);
|
|
||||||
|
|
||||||
void onOpen(websocketpp::connection_hdl hdl);
|
void onOpen(websocketpp::connection_hdl hdl);
|
||||||
void onClose(websocketpp::connection_hdl hdl);
|
void onClose(websocketpp::connection_hdl hdl);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user