Newer
Older
ZXSSCJ / CounterRealTime / common / HttpServer.h
#ifndef HTTPSERVER_H
#define HTTPSERVER_H

#include <QObject>
#include <QtNetwork>
#include <QJsonObject>
#include <QJsonDocument>

class HttpServer : public QObject
{
    Q_OBJECT
public:
    static HttpServer &instance();
    void run(const QHostAddress &address = QHostAddress::Any, const quint16 &port = 5905);

private:
    explicit HttpServer(QObject *parent = nullptr);
    ~HttpServer();
    Q_DISABLE_COPY(HttpServer)

    QTcpServer * httpServer;

    QString buildHeartBeatResponse();

signals:

public slots:
private slots:
    void newConnection();
    void readyRead();
};

#endif // HTTPSERVER_H