Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
Executable
+64
@@ -0,0 +1,64 @@
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QtNetwork/QHostAddress>
|
||||
#include <QtWebSockets/qwebsocketprotocol.h>
|
||||
#include <QtWebSockets/QWebSocketServer>
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
namespace LtsWebSocket
|
||||
{
|
||||
class MessageHandler;
|
||||
class ClientConnection;
|
||||
class ReplyMessage;
|
||||
|
||||
|
||||
|
||||
class ConnectionHandler
|
||||
: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
|
||||
explicit ConnectionHandler(QObject *parent = nullptr);
|
||||
~ConnectionHandler();
|
||||
|
||||
|
||||
|
||||
bool init(const QString &serviceName, unsigned short port);
|
||||
|
||||
|
||||
|
||||
void sendToAllClients(ReplyMessage *message);
|
||||
|
||||
|
||||
|
||||
unsigned short webSocketPort() { return m_server->serverPort(); }
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
void newTextMessageFromClient(ClientConnection *client, const QString &message);
|
||||
|
||||
|
||||
|
||||
void clientDisconnected(ClientConnection *client);
|
||||
|
||||
|
||||
|
||||
void clientConnected(ClientConnection *client);
|
||||
|
||||
private slots:
|
||||
void onServerError(QWebSocketProtocol::CloseCode closeCode);
|
||||
void onNewConnection();
|
||||
|
||||
private:
|
||||
QWebSocketServer *m_server;
|
||||
QSet<ClientConnection *> m_connections;
|
||||
LOGGER_T m_logger;
|
||||
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user