#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
