1 #ifndef VFS_WEBSOCKET_CLIENT_H
2 #define VFS_WEBSOCKET_CLIENT_H
5 #include <QHostAddress>
48 virtual QJsonDocument
receive(QByteArray message);
57 void error(QAbstractSocket::SocketError);
VFS_node is the base class from which all other VFS_node classes derive.
The base class for all requests between nodes.
A VFS_node that manages a QWebSocket connection.
virtual bool isConnecting()
If the client will attempt to reconnect, return true.
bool _isClient
A client connection may not be created by a listening server, thus the second constructor.
virtual void submit(VFS_request *r)
Submit to the socket.
int _pingID
Connections can become stale; This is the ID of the ping timer.
VFS_websocket_client(QWebSocket *socket, VFS_websocket_server *server)
QString _wsurl
For client connections, the WebSocket address to connect to.
QHostAddress _address
The network address of the connected client.
quint16 _interval
The reconnect interval if disconnected.
virtual void authorized()
Notify the node that it has received authorization from some auth method.
void connected()
Connection has been made.
bool _authorized
if this connection has a session
virtual void write(VFS_request *r)
Write to the socket.
virtual void socket_receive_text(QString message)
The socket has received a message in text mode.
void readyTextMessage(QString message)
A text message has been received.
virtual void socket_connected()
Slot called when the client is connected.
int _connectID
For client connections, the reconnect timerID.
virtual void socket_disconnected()
Slot called when the client is disconnected.
virtual ~VFS_websocket_client()
VFS_websocket_client destructor -.
VFS_websocket_server * _server
owning server
virtual void timerEvent(QTimerEvent *event)
Send the ping command.
void readyBinaryMessage(QByteArray message)
A binary message has been received.
bool _authenticated
if auth has taken place and succeeded
virtual void init()
Initialize needed signal/slot connections.
virtual void close()
Close the socket if it is connected.
virtual bool isConnected()
If the client will attempt to reconnect, return true.
virtual bool writeBinary(QByteArray data)
Write binary data over the websocket.
void error(QAbstractSocket::SocketError)
There has been a socket error.
virtual void startPing()
Start the ping timer.
QWebSocket * _socket
client socket
void disconnected()
Connection has been lost.
virtual bool writeText(QString data)
Write text data over the websocket.
virtual void socket_receive_binary(QByteArray message)
VFS_websocket_client::socket_receive_binary.
virtual QJsonDocument receive(QByteArray message)
VFS_websocket_VFSclient::receive.
virtual bool isContainer()
A VFS_websocket_client cannot contain children.
A VFS_websocket server will listen for incoming websocket connections, optionally using ssl.