This class represents the websocket server for nymead. More...
Header: | #include <WebSocketServer> |
Inherits: | TransportInterface |
WebSocketServer(const ServerConfiguration & configuration, const QSslConfiguration & sslConfiguration, QObject * parent = nullptr) | |
~WebSocketServer() | |
QUrl | serverUrl() const |
virtual void | sendData(const QUuid & clientId, const QByteArray & data) |
virtual void | sendData(const QList<QUuid> & clients, const QByteArray & data) |
virtual void | terminateClientConnection(const QUuid & clientId) |
void | reconfigureServer(const ServerConfiguration & config) |
virtual void | setServerName(const QString & serverName) |
virtual bool | startServer() |
virtual bool | stopServer() |
This class represents the websocket server for nymead.
Note: The WebSocketServer is only available for builds with Qt version greater than Qt 5.3.0!
The websocket server provides a server for websocket clients based on Protocol Version 13. The default port for the websocket server is 4444, which is according to this list officially free.
The URL for the insecure websocket:
ws://localhost:4444
The URL for the secure websocket (TLS 1.2):
wss://localhost:4444
You can turn on the wss
server in the WebServerServer
section of the /etc/nymea/nymead.conf
file.
Note: For wss
you need to have a certificate and configure it in the SSL-configuration
section of the /etc/nymea/nymead.conf
file.
See also WebServer, TcpServer, and TransportInterface.
Constructs a WebSocketServer with the given configuration, sslConfiguration and parent.
See also ServerManager and ServerConfiguration.
Destructor of this WebSocketServer.
[slot]
void WebSocketServer::reconfigureServer(const ServerConfiguration & config)Returns true if this WebSocketServer could be reconfigured with the given config.
[virtual]
void WebSocketServer::sendData(const QUuid & clientId, const QByteArray & data)Reimplemented from TransportInterface::sendData().
Send the given data map to the client with the given clientId.
See also TransportInterface::sendData().
[virtual]
void WebSocketServer::sendData(const QList<QUuid> & clients, const QByteArray & data)Reimplemented from TransportInterface::sendData().
Send the given data map to the given list of clients.
See also TransportInterface::sendData().
Returns the url of this server.
[virtual slot]
void WebSocketServer::setServerName(const QString & serverName)Reimplemented from TransportInterface::setServerName().
Sets the server name to the given serverName.
[virtual slot]
bool WebSocketServer::startServer()Reimplemented from TransportInterface::startServer().
Returns true if this WebSocketServer started successfully.
See also TransportInterface::startServer().
[virtual slot]
bool WebSocketServer::stopServer()Reimplemented from TransportInterface::stopServer().
Returns true if this WebSocketServer stopped successfully.
See also TransportInterface::stopServer().
[virtual]
void WebSocketServer::terminateClientConnection(const QUuid & clientId)