Refactor server services to share more code
This commit is contained in:
parent
37c0c5d17b
commit
5cd7c782ce
9 changed files with 280 additions and 85 deletions
32
src/service/websocketserver.h
Normal file
32
src/service/websocketserver.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#ifndef WEBSOCKETSERVER_SERVER_H
|
||||
#define WEBSOCKETSERVER_SERVER_H
|
||||
|
||||
#include <QWebSocketServer>
|
||||
#include <vector>
|
||||
|
||||
#include "server.h"
|
||||
|
||||
class WebSocketServer : public Server
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QWebSocketServer server;
|
||||
|
||||
public:
|
||||
WebSocketServer(const QString &serverName, QObject* parent = nullptr);
|
||||
virtual ~WebSocketServer();
|
||||
virtual bool launch(const QHostAddress &address = QHostAddress::Any, quint16 port = 0) override;
|
||||
virtual void sendJson(const QJsonObject& json) override;
|
||||
|
||||
private slots:
|
||||
void incomingConnection();
|
||||
void textMessageReceived(const QString &message);
|
||||
|
||||
protected:
|
||||
virtual void processIncomeingJson(const QByteArray& jsonbytes) override;
|
||||
|
||||
signals:
|
||||
void sigRequestSave();
|
||||
};
|
||||
|
||||
#endif // WEBSOCKETSERVER_SERVER_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue