1 #ifndef VFS_WEBSOCKET_SERVER_H
2 #define VFS_WEBSOCKET_SERVER_H
4 #include <QWebSocketServer>
16 explicit VFS_websocket_server(quint16 port, QString authPaths, QString sessions, QHostAddress addr=QHostAddress::Any, QWebSocketServer::SslMode ssl=QWebSocketServer::NonSecureMode, QString sslCertPath=
"", QString sslKeyPath=
"");
27 QWebSocketServer::SslMode
_ssl;
45 virtual void serverError(QWebSocketProtocol::CloseCode closeCode);
50 virtual void sslErrors(
const QList<QSslError> &errors);
VFS_node is the base class from which all other VFS_node classes derive.
A VFS_node that manages a QWebSocket connection.
void error(QAbstractSocket::SocketError)
There has been a socket error.
A VFS_websocket server will listen for incoming websocket connections, optionally using ssl.
virtual ~VFS_websocket_server()
VFS_websocket_server destructor.
virtual bool authenticate(VFS_websocket_client *client, QJsonObject credentials)
Authenticate a client based on received credentials.
QHostAddress _listenAddress
Address to listen on, or 0.0.0.0 for all.
QStringList _authPaths
The list of auth paths to query when a user request authentication.
quint16 _port
Port to listen on.
virtual void sslErrors(const QList< QSslError > &errors)
One or more ssl errors have occurred.
QString _sslCertPath
ssl cert file path
QString _sessionsPath
The path to the sessionManager node.
QWebSocketServer _socket
The QWebSocket server object that will be listening.
virtual void clientTextMessage(QString message)
A client has received a text websocket message.
virtual void serverError(QWebSocketProtocol::CloseCode closeCode)
A server socket error has occurred.
virtual void clientBinaryMessage(QByteArray message)
The client has received a binary websocket message.
virtual void newConnection()
A new connection has been requested, and is pending.
virtual void clientError(QAbstractSocket::SocketError error)
A socket error has occurred.
VFS_websocket_server(quint16 port, QString authPaths, QString sessions, QHostAddress addr=QHostAddress::Any, QWebSocketServer::SslMode ssl=QWebSocketServer::NonSecureMode, QString sslCertPath="", QString sslKeyPath="")
VFS_websocket_server constructor.
QString _sslKeyPath
ssl key file path
virtual void authorize(VFS_websocket_client *client, QJsonObject authdata)
Authorize a client and create a session based on type and username.
virtual bool isContainer()
A VFS_websocket_server is always a container; it's children will be the connected clients.
QWebSocketServer::SslMode _ssl
Use ssl?
virtual bool listen()
Start listening on the _socket for incoming connections.
virtual void closeConnection()
Close a child client connection, and remove() it from this node's child list.
virtual VFS_websocket_client * createWebsocketClient(QWebSocket *s)
Create a VFS_websocket_client to host a new connection.