This class represents the web server for nymead. More...
Header: | #include <WebServer> |
Inherits: |
WebServer(const WebServerConfiguration & configuration, const QSslConfiguration & sslConfiguration, QObject * parent = nullptr) | |
~WebServer() | |
void | sendHttpReply(HttpReply * reply) |
QUrl | serverUrl() const |
void | reconfigureServer(const WebServerConfiguration & config) |
void | setServerName(const QString & serverName) |
bool | startServer() |
bool | stopServer() |
void | clientConnected(const QUuid & clientId) |
void | clientDisconnected(const QUuid & clientId) |
void | httpRequestReady(const QUuid & clientId, const HttpRequest & httpRequest) |
void | incomingConnection(qintptr socketDescriptor) |
This class represents the web server for nymead.
The WebServer class provides a HTTP/1.1 web server. The web server provides access to the nymea-webinterface and the path can be specified in the /etc/nymea/nymead.conf
file and to the nymea REST API. The default port for the web server is 3333, which is according to this list officially free.
The URL for the insecure nymea-webinterface access:
http://localhost:3333
The URL for the secure HTTPS (TLS 1.2) nymea-webinterface access:
https://localhost:3333
The URL for the insecure REST API access to a RestResource:
http://localhost:3333/api/v1/{RestResource}
The URL for the secure HTTPS (TLS 1.2) REST API access to a RestResource:
https://localhost:3333/api/v1/{RestResource}
You can turn on the HTTPS server in the WebServer
section of the /etc/nymea/nymead.conf
file.
Note: For HTTPS
you need to have a certificate and configure it in the SSL-configuration
section of the /etc/nymea/nymead.conf
file.
See also WebServerClient, WebSocketServer, and TcpServer.
Constructs a WebServer with the given configuration, sslConfiguration and parent.
See also ServerManager and WebServerConfiguration.
Destructor of this WebServer.
[signal]
void WebServer::clientConnected(const QUuid & clientId)This signal is emitted when a new client with the given clientId has been connected.
[signal]
void WebServer::clientDisconnected(const QUuid & clientId)This signal is emitted when a client with the given clientId has been disconnected.
[signal]
void WebServer::httpRequestReady(const QUuid & clientId, const HttpRequest & httpRequest)This signal is emitted when a httpRequest from a client with the given clientId is ready.
See also RestServer and HttpRequest.
[protected]
void WebServer::incomingConnection(qintptr socketDescriptor)Overwritten virtual method from QTcpServer::incomingConnection( socketDescriptor).
[slot]
void WebServer::reconfigureServer(const WebServerConfiguration & config)Set the configuration of this WebServer to the given config.
See also WebServerConfiguration.
Send the given reply map to the corresponding client.
See also HttpReply.
Returns the server URL of this WebServer.
[slot]
void WebServer::setServerName(const QString & serverName)Sets the server name to the given serverName.
[slot]
bool WebServer::startServer()Returns true if this WebServer started successfully.
[slot]
bool WebServer::stopServer()Returns true if this WebServer stopped successfully.