• WebServer
  • WebServer Class

    class nymeaserver::WebServer

    This class represents the web server for nymead. More...

    Header: #include <WebServer>

    Public Functions

    void setServerName(const int &serverName)
    bool startServer()
    bool stopServer()

    Protected Functions

    void clientConnected(const int &clientId)
    void clientDisconnected(const int &clientId)
    void incomingConnection(int socketDescriptor) override

    Detailed Description

    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:

    The URL for the secure HTTPS (TLS 1.2) nymea-webinterface access:
    \code https://localhost:3333

    The URL for the insecure REST API access to a RestResource:

    The URL for the secure HTTPS (TLS 1.2) REST API access to a \l{RestResource}:
    \code 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.

    Member Function Documentation

    [protected] void WebServer::clientConnected(const int &clientId)

    This signal is emitted when a new client with the given clientId has been connected.

    [protected] void WebServer::clientDisconnected(const int &clientId)

    This signal is emitted when a client with the given clientId has been disconnected.

    [protected] void WebServer::incomingConnection(int socketDescriptor)

    Overwritten virtual method from QTcpServer::incomingConnection( socketDescriptor).

    void WebServer::setServerName(const int &serverName)

    Sets the server name to the given serverName.

    bool WebServer::startServer()

    Returns true if this WebServer started successfully.

    bool WebServer::stopServer()

    Returns true if this WebServer stopped successfully.